Created
February 29, 2012 07:13
-
-
Save nicokruger/1938802 to your computer and use it in GitHub Desktop.
async-sync-pattern
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 actions = [ | |
function () { | |
/* code for step 1 */ | |
callback(); | |
}, function () { | |
/* code for step 2 */ | |
callback(); | |
}, function () { | |
/* code for step 3 */ | |
callback(); | |
}, function () { | |
/* code for step 4 */ | |
callback(); | |
}, function(){ | |
/* code for step 5 */ | |
callback(); | |
}, function () { | |
/* code for step 6 */ | |
callback(); | |
} | |
]; | |
function callback() { | |
if (actions.length) { | |
actions.shift()(); | |
} else { | |
console.log("Done"); | |
} | |
} | |
callback(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment