Is it possible to dynamically add a callback to every function encapsulated within a function/coffeescript class? Like an after_filter in rails.
For example:
class Parent
after_every_function_call_myCallback
myCallback: ->
console.log “callback called“
class Child extends Parent
doSomething: ->
console.log “a function“
class Regular
doSomething: ->
console.log “a regular function“
> reg = new Regular()
> reg.doSomething()
< “a regular function“
> child = new Child()
> child.doSomething()
< “a function“
< “callback called“
for k, f of Child::to loop, then you canChild::[k] = after Parent::myCallback, f, whereafteris a higher-order function that decorates another function. But again, it is manual, at least if you want to use Coffee classes