Skip to content

Instantly share code, notes, and snippets.

@msuarz
Created April 27, 2012 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msuarz/2509957 to your computer and use it in GitHub Desktop.
Save msuarz/2509957 to your computer and use it in GitHub Desktop.
async vs step
async.series [
(done) -> fs.writeFile '/tmp/test', 'yay', ->
console.log 'yay!!'
done null
(done) ->
console.log 'hello'
done null
-> console.log 'world'
]
step(
-> fs.writeFile '/tmp/test', 'yay', @
->
console.log 'yay!!'
@
->
console.log 'hello'
@
-> console.log 'world'
)
@jperkelens
Copy link

writeFile = (done) -> fs.writeFile '/tmp/test', 'yay', ->
console.log 'yay!!'
done null
logMessage = (done) ->
console.log 'hello'
done null
anotherMessage = -> console.log 'world'

async.series [writeFile, logMessage, anotherMessage]

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