Skip to content

Instantly share code, notes, and snippets.

@MikeBild
Created October 22, 2012 13:42
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 MikeBild/3931562 to your computer and use it in GitHub Desktop.
Save MikeBild/3931562 to your computer and use it in GitHub Desktop.
for example - encapsulate callback in this context with step
var step = require("step");
var weasel1 = function(callback) {
callback(null, 'first');
}
var weasel2 = function(callback) {
callback(null, 'second');
}
var combineWeasel = function(a,b, callback) {
callback(null, a + ', ' + b + ' weasel.');
}
step(function(){
weasel1(this.parallel());
weasel2(this.parallel());
},
function(err, a, b) {
combineWeasel(a, b, this);
},
function(err, c) {
console.log(c);
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment