Last active
March 8, 2017 05:01
-
-
Save toddzebert/31ab0c2ff1fe6c449ae63b2272858a51 to your computer and use it in GitHub Desktop.
Nested Async Callback example w/"all" pattern - check the console log
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
// requires https://gist.github.com/toddzebert/7c0aa1f1ee3be2d39d301bd875fead25 | |
// requires https://gist.github.com/toddzebert/ef155ae58efb5a3788a7b143b0f7d215 | |
var posts = [], data = { id: 4 }; | |
getAuth(data, function (res) { | |
data.auth = res; | |
getProfile(data, function (res) { | |
data.profile = res; | |
getFeed(data, function (res) { | |
data.feed = res; | |
var getPosts = data.feed.map(post => getPost(post)); | |
all(getPosts, function(res) { | |
data.posts = posts; | |
console.log(data); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment