Skip to content

Instantly share code, notes, and snippets.

@maxbeatty
Created December 14, 2013 01:44
Show Gist options
  • Save maxbeatty/7954626 to your computer and use it in GitHub Desktop.
Save maxbeatty/7954626 to your computer and use it in GitHub Desktop.
Keeping variables scoped for [step](https://github.com/creationix/step) calls
Step = require 'step'
Step(
->
return 'mine'
(err, @scoped) ->
console.log '1', @scoped
return 'diff1'
(err, msg) ->
console.log '2', @scoped, msg
@ null, 'diff2'
(err, msg) ->
console.log '3', @scoped, msg
)
console.log 'gone', @scoped
###
$ coffee step-test.coffee
1 mine
2 mine diff1
3 mine diff2
gone undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment