minor
This commit is contained in:
parent
2f4242c7bd
commit
c96881755e
11 changed files with 408 additions and 0 deletions
0
8-async/03-promise-chaining/article.md
Normal file
0
8-async/03-promise-chaining/article.md
Normal file
10
8-async/03-promise-chaining/head.html
Normal file
10
8-async/03-promise-chaining/head.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<script>
|
||||
function loadImage(src) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let img = document.createElement('img');
|
||||
img.src = src;
|
||||
img.onload = () => resolve(img);
|
||||
img.onerror = () => reject(new Error("Image load failed: " + src));
|
||||
});
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue