Skip to content

Instantly share code, notes, and snippets.

@purplefox
Created March 26, 2012 10:47
Show Gist options
  • Save purplefox/2204406 to your computer and use it in GitHub Desktop.
Save purplefox/2204406 to your computer and use it in GitHub Desktop.
I need a reference so I can unregister a handler from within a handler. otherwise would need to declare the handler first, put it in a variable and use that.
Wanna be able to do this with anon handlers
foo.registerHandler(myClosure = {
// Do something
// Now unregister handler
foo.unregisterHandler(myClosure)
})
@pledbrook
Copy link

getSelf() on Closure for 2.0 would get my vote, but it does probably constitute a breaking change and undoubtedly there would be confusion between 'this' and 'self'. Anyway, this is a digression, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment