4 ms·
Is this different from async.series? If so, in what way?
by tspike 13y ago
Is this different from async.series? If so, in what way?
- lucio 13y ago- syntax - 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);
- htilford 13y ago> ¿how do you use results from the first function on the second or third? waterfall async.waterfall([ function (cb) { . . . cb(stuff); }, function (stuff, cb) { . . .