Skip to content

Instantly share code, notes, and snippets.

@leedm777
Created August 2, 2012 02:01
Show Gist options
  • Select an option

  • Save leedm777/3232433 to your computer and use it in GitHub Desktop.

Select an option

Save leedm777/3232433 to your computer and use it in GitHub Desktop.
Insanity of callbacks
getSomething(function(thing) {
doSomethingWithIt(thing, function(somethingElse) {
evenSomethingElse(somethingElse, function(inTooDeep) {
// result A
})
})
doSomethingElseWithIt(thing, function(somethingElse) {
// result B
})
whenBothAreDone(thing, A, B) // magic!
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment