Skip to content

Instantly share code, notes, and snippets.

@nkbt
Created February 27, 2014 00:07
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 nkbt/9241570 to your computer and use it in GitHub Desktop.
Save nkbt/9241570 to your computer and use it in GitHub Desktop.
async.auto
var _ = require('underscore');
var async = require('async');
async.auto({
first: function(next) {
setTimeout(next, 500);
},
second: function(next) {
setTimeout(next, 700);
},
third: ['first', 'second', function(next) {
setTimeout(next, 2000);
}],
final: ['third', function(next) {
next(null, 'OK');
}]
}, function(error, results) {
console.log(error, results);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment