Skip to content

Instantly share code, notes, and snippets.

@k9ordon
Created August 4, 2014 11:28
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 k9ordon/19e284a8a3a285415e5a to your computer and use it in GitHub Desktop.
Save k9ordon/19e284a8a3a285415e5a to your computer and use it in GitHub Desktop.
nodejs simple sync
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