Skip to content

Instantly share code, notes, and snippets.

@pikeas
Created September 25, 2011 08:36
Show Gist options
  • Save pikeas/1240388 to your computer and use it in GitHub Desktop.
Save pikeas/1240388 to your computer and use it in GitHub Desktop.
Callback confusion 2
#I'm trying to write a wrapper function to use in place of long nested callbacks like a(b(c())).
runner = (cb, args...) ->
puts 'run'
cb(args...)
a = (cb, args...) ->
puts 'a'
cb(args...)
b = (cb, args...) ->
puts 'b'
cb(args...)
c = ->
puts 'c'
#Why doesn't this work?
runner(a, b, c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment