Skip to content

Instantly share code, notes, and snippets.

@mlconnor
Created March 18, 2014 19:52
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 mlconnor/9628048 to your computer and use it in GitHub Desktop.
Save mlconnor/9628048 to your computer and use it in GitHub Desktop.
Using async in node.js
var async = require('async'),
async.series([
function(callback) {
setTimeout(function() {
console.log('f1');
callback(null, 'one');
}, 800);
},
function(callback) {
setTimeout(function() {
console.log('f2');
callback(null, 'two');
}, 800);
},
function(callback) {
setTimeout(function() {
console.log('f3');
callback(null, 'three');
}, 800);
},
], function(err, result) {
console.log('res',result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment