Created
May 17, 2011 13:33
-
-
Save michiel/976470 to your computer and use it in GitHub Desktop.
Sequencer in coffeescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sequence = (arr) -> | |
self = -> | |
if arr.length then arr.shift() self | |
self() | |
async = (callback) -> | |
console.log "Calling callback after 1s" | |
setTimeout callback, 1000 | |
sequence [async, async, async] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Functions can be inlined as follows,