Created
August 4, 2014 11:28
-
-
Save k9ordon/19e284a8a3a285415e5a to your computer and use it in GitHub Desktop.
nodejs simple sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var init = function() { | |
next(); | |
}; | |
var next = function() { | |
++idx; | |
if(!steps[idx]) process.exit(); | |
steps[idx](next); | |
}; | |
var idx = -1, | |
steps = [ | |
function(done) { | |
console.log('step 1'); | |
done(); | |
}, | |
function(done) { | |
console.log('step 2'); | |
done(); | |
} | |
]; | |
init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment