Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.