-
Notifications
You must be signed in to change notification settings - Fork 0
/
page2.html
39 lines (32 loc) · 882 Bytes
/
page2.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>
<head>
<meta charset="UTF-8">
<title>page2</title>
<script src="http://cdn.jsdelivr.net/bluebird/3.5.0/bluebird.min.js"></script>
</head>
<body>
<!-- clock -->
<p><span id="clock"></span> milliseconds since January 1970</p>
<script>
setInterval(function() {
var d = new Date();
document.getElementById("clock").innerHTML = d + "<br>" + d.getTime();
}, 100); // Update 10 times a second
</script>
<!-- spin -->
<p><button onclick="spin7()">7. bluebird</button> <span id="result7"></span></p>
<script>
function spin7() {
var count = 0;
var start = Date.now();
f();
function f() {
count++;
if (Date.now() < start + 1000) Promise.resolve().then(f);
else document.getElementById("result7").innerHTML = count;
}
}
</script>
</body>
</html>