var async = require(‘async‘);
//串行无关联
async.series({
???????one:function(cb) {
???????setTimeout(function(){
???????console.log(‘111111111‘);
???????cb(‘有错‘, 1);
???????}, 3000);
???????????????
???????},
???????two:function(cb) {
???????setTimeout(function(){
???????console.log(‘222222222‘);
???????cb(null, 2);
???????}, 2000);
???????????????
???????},
???????three:function(cb) {
???????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/7439876.html