/**
* Created with JetBrains WebStorm.
* User: hexie
* Date: 12-12-6
* Time: 上午9:58
* To change this template use File | Settings | File Templates.
*/
var async = require('async');
async.waterfall([
function(callback){
callback(null, 'one', 'two');
console.log('1');
},
function(arg1, arg2, callback){
callback(null, 'three');
console.log(arg1);
console.log(arg2);
},
function(arg1, callback){
// arg1 now equals 'three'
callback(null, 'done');
console.log(arg1);
}
], function (err, result) {
console.log(result);
// result now equals 'done'
// console.log('4');
});
node.js 之async.js 里waterfall模块样例
最新推荐文章于 2020-11-07 15:56:39 发布