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