Created
September 24, 2014 15:23
-
-
Save ovaillancourt/99541cf42f16cf753ada to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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