Created
October 22, 2012 13:42
-
-
Save MikeBild/3931562 to your computer and use it in GitHub Desktop.
for example - encapsulate callback in this context with step
This file contains 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
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