-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
39 lines (35 loc) · 914 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="promise.js"></script>
<script>
var promise1 = new MyPromise(function (resolve, reject) {
setTimeout(function () {
reject("promise 1 error value");
}, 1000);
});
var promise2 = new MyPromise(function (resolve, reject) {
setTimeout(function () {
resolve("promise 2 value");
}, 500);
});
var promise3 = new MyPromise(function (resolve, reject) {
setTimeout(function () {
resolve("promise 3 value");
}, 3000);
});
MyPromise.all([promise1, promise2, promise3])
.then(function (results) {
console.log(results);
})
.catch(function (error) {
console.log(error);
});
</script>
</body>
</html>