Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ayapi
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayapi/9257773 to your computer and use it in GitHub Desktop.
Save ayapi/9257773 to your computer and use it in GitHub Desktop.
async.series()のサンプル
var async = require('async');
var tasks = {
get: function(done){
console.log('get');
setTimeout(done, 1000);
},
send: function(done){
console.log('send');
//setTimeout(done, 1000);
setTimeout(function(){
done(new Error('send:failed'))
}, 1000);
},
save: function(done){
console.log('save');
setTimeout(done, 1000);
}
};
async.series(tasks, function(err){
if(err){
console.log(err.message);
}else{
console.log('success');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment