Skip to content

Instantly share code, notes, and snippets.

@ovaillancourt
Created September 24, 2014 15:23
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 ovaillancourt/99541cf42f16cf753ada to your computer and use it in GitHub Desktop.
Save ovaillancourt/99541cf42f16cf753ada to your computer and use it in GitHub Desktop.
var steps = [
function step1(){
console.log('step1');
this();
},
function step2(){
console.log('step2');
this();
}
];
function doAsync(steps, done){
var index = 0;
function doNext(){
if(index < steps.length){
steps[index++].call(doNext);
} else {
done();
}
}
doNext();
}
doAsync(steps, function(){
console.log('im done');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment