Last active
August 29, 2015 13:57
-
-
Save lennybacon/9682879 to your computer and use it in GitHub Desktop.
Using the chaining asynchronous JavaScript calls with Angular JS
This file contains 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
function f1(callback) { | |
console.log('f1'); | |
if (callback != null) { | |
console.log('hasCallback'); | |
callback(); | |
} | |
} | |
function f2(callback) { | |
console.log('f2'); | |
if (callback != null) { | |
console.log('hasCallback'); | |
callback(); | |
} | |
} | |
function f3(callback) { | |
console.log('f3'); | |
if (callback != null) { | |
console.log('hasCallback'); | |
callback(); | |
} | |
} | |
var cc = callChain(); | |
cc.add(f1); | |
cc.add(f2); | |
cc.add(f3); | |
cc.execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment