Skip to content

Instantly share code, notes, and snippets.

@andijakl
Created October 8, 2018 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andijakl/0584c1d2caa83b0c7a536a2049008c0a to your computer and use it in GitHub Desktop.
Save andijakl/0584c1d2caa83b0c7a536a2049008c0a to your computer and use it in GitHub Desktop.
Example for the "Callback Hell" with chained web requests
request("https://www.andreasjakl.com/wp-content/uploads/2018/08/arcore-anchors.gif", function(error, response, body) {
if (error) {
// Handle error
console.log("Error: ", error);
} else {
if (response && response.statusCode == 200) {
request("https://www.andreasjakl.com/wp-content/uploads/2018/08/SLAM-HoloLens-2000x1163.jpg", function(error, response, body) {
if (error) {
console.log("Error: ", error);
} else {
console.log("status code:" , response && response.statusCode);
}
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment