Skip to content

Instantly share code, notes, and snippets.

@525c1e21-bd67-4735-ac99-b4b0e5262290
Created January 19, 2011 17:15
Show Gist options
  • Save 525c1e21-bd67-4735-ac99-b4b0e5262290/786466 to your computer and use it in GitHub Desktop.
Save 525c1e21-bd67-4735-ac99-b4b0e5262290/786466 to your computer and use it in GitHub Desktop.
callbacks = foo: true, bar: true
callback = (handle) ->
delete callbacks[handle]
if callbacks.foo and callbacks.bar
# do something after foo and bar
# do some foo
some_async_method 'some string', ->
callback 'foo'
# do some bar
some_async_method 'some string', ->
callback 'bar'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment