This commit is contained in:
Ilya Kantor 2019-08-14 12:36:24 +03:00
parent b753823786
commit 39309e6a07
19 changed files with 60 additions and 35 deletions

View file

@ -223,6 +223,30 @@ As calls become more nested, the code becomes deeper and increasingly more diffi
That's sometimes called "callback hell" or "pyramid of doom."
<!--
loadScript('1.js', function(error, script) {
if (error) {
handleError(error);
} else {
// ...
loadScript('2.js', function(error, script) {
if (error) {
handleError(error);
} else {
// ...
loadScript('3.js', function(error, script) {
if (error) {
handleError(error);
} else {
// ...
}
});
}
})
}
});
-->
![](callback-hell.svg)
The "pyramid" of nested calls grows to the right with every asynchronous action. Soon it spirals out of control.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Before After
Before After