Skip to content

Instantly share code, notes, and snippets.

@rlidwka
Created April 5, 2012 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlidwka/2309325 to your computer and use it in GitHub Desktop.
Save rlidwka/2309325 to your computer and use it in GitHub Desktop.
class WrapFunc
constructor: ->
for key of @
do (key) =>
old_fn = @[key]
@[key] = =>
console.log('wrapping call to ' + key)
old_fn.apply(@, arguments)
f: ->
console.log('calling f')
g: ->
console.log('calling g')
h: ->
console.log('calling h')
w = new WrapFunc()
w.f()
w.h()
w.g()
w.f()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment