Is this different from async.series? If so, in what way?
- wait.for it's simpler
- wait.for uses try/catch
I don't know async.series deeply, but, ¿how do you use results from the first function on the second or third?
wait.for:
try{
data = wait.for(function1);
result = wait.for(function2, data);
}
catch(err){
// error handling
};
async.series: async.series([
function1,
function2
],
// optional callback
function(err, results){
// results is now equal to ['one', 'two']
});
async has a lot of functionality. You can use wait.for and async at the same time. They supply different functionality.Example:
results = wait.for(async.map,['file1','file2','file3'], fs.stat);waterfall
async.waterfall([
function (cb) {
. . .
cb(stuff);
},
function (stuff, cb) {
. . .