-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
82 lines (70 loc) · 2.6 KB
/
index.html
File metadata and controls
82 lines (70 loc) · 2.6 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="anime.min.js"></script>
<script src="index.js"></script>
<style>
body {
display: flex;
flex-wrap: wrap;
flex-flow: column;
}
svg {
width: 100%;
height: 50px;
}
#anime-demo {
text-align: left;
width: 100%;
height: 100%;
}
.promise {
color: red;
}
pre code {
background-color: #eee;
border: 1px solid #999;
display: block;
}
header {
left:15px;
width:100%;
}
</style>
<title>Promise.all visualized</title>
</head>
<body>
<header>Author: Sohn Dangen | <a href="https://github.com/dangen-effy/Promise-all-visualized">GitHub</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all">MDN</a></header>
<h1 style="margin-bottom: 0;">Promise.all visualized</h1>
<pre>
<code>
console.log('Hello. Promise.all')
const task0 = new Promise(...)
const task1 = new Promise(...)
const task2 = new Promise(...)
await Promise.all([task0, task1, task2])
console.log('Jobs done')
</code>
</pre>
<div id="anime-demo">
<svg>
<text id="text0" x="0" y="15" fill="red">Pending ...</text>
<circle id="circle0" class="circle" cx="25" cy="25" r="12" fill="#ED6E46" stroke="#000" stroke-width="3"/>
</svg>
<svg>
<text id="text1" x="0" y="15" fill="red">Pending ...</text>
<circle id="circle1" class="circle" cx="25" cy="25" r="12" fill="#ED6E46" stroke="#000" stroke-width="3"/>
</svg>
<svg>
<text id="text2" x="0" y="15" fill="red">Pending ...</text>
<circle id="circle2" class="circle" cx="25" cy="25" r="12" fill="#ED6E46" stroke="#000" stroke-width="3"/>
</svg>
<p style="font-weight: bold;">Promise.all [<span class="promise" id="promise0">Task0</span>, <span class="promise" id="promise1">Task1</span>, <span class="promise" id="promise2">Task2</span>] <span id="promise-status">Pending ...</span></p>
<h3>💻 Outputs:</h3>
<p id="console0" style="color: transparent;">> Hello. Promise.all</p>
<p id="console1" style="color: transparent;">> Jobs done</p>
</div>
</body>
</html>