首页 / 操作系统 / Linux / Node.js 之async.js 里waterfall模块样例
Node.js 之async.js 里waterfall模块样例/**
* 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");
});