首页 > Web开发 > 详细

nodejs串行有关联

时间:2017-08-27 11:34:03      阅读:541      评论:0      收藏:0      [点我收藏+]

var async = require(‘async‘);

//串行无关联series
//串行有关联waterfall
async.waterfall([
function(cb) {
setTimeout(function(){
console.log(‘111111111‘);
cb(null, 1);
}, 3000);

},
function(param,cb) {
console.log(‘one传来:‘+param);
setTimeout(function(){
console.log(‘222222222‘);
cb(null, 2);
}, 2000);

},
function(param,cb) {
console.log(‘two传来:‘+param);
setTimeout(function(){
console.log(‘333333333‘);
cb(null, 3);
}, 1000);
}
],
function(err, value) {
if(err){
console.log(err);
}
// do somethig with the err or values v1/v2/v3
console.log(value);
}
);

nodejs串行有关联

原文:http://www.cnblogs.com/yu-hailong/p/7439880.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!