Skip to content

Instantly share code, notes, and snippets.

@toddzebert
Last active March 7, 2017 08:45
Show Gist options
  • Save toddzebert/cee6d8b0475275be0f48d7dfef142bd3 to your computer and use it in GitHub Desktop.
Save toddzebert/cee6d8b0475275be0f48d7dfef142bd3 to your computer and use it in GitHub Desktop.
Nested Async Callback example - check the console log
// requires https://gist.github.com/toddzebert/ca9b735f1fbcd627ddfead4a87378adb
var data = { id: 4 };
getAuth(data, function (res) {
data.auth = res;
getProfile(data, function (res) {
data.profile = res;
getFeed(data, function (res) {
data.feed = res;
console.log(data); // callback hell
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment