-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
54 lines (51 loc) · 1.4 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<button id="btn">press</button>
<button id="btn2">loc</button>
<button id="btn3">msg - down</button>
<button id="btn4">msg - click</button>
<button id="btn5">msg - up</button>
<div id="pressed">false</div>
<script>
btn.addEventListener('mousedown', () => {
pressed.textContent = 'true';
window.parent.postMessage('clicked', '*');
});
btn.addEventListener('mouseup', () => {
var num = 0;
for (let i = 0; i < 500000000; i++) {
num += Date.now();
}
console.log(num);
}, 1);
btn.addEventListener('click', () => {
var num = 0;
for (let i = 0; i < 5000; i++) {
num += Date.now();
}
console.log(num);
}, 1);
btn2.addEventListener('mousedown', () => {
window.location.href="http://jsbin.testim.io/dan";
});
btn3.addEventListener('mousedown', () => {
pressed.textContent = 'true';
window.parent.postMessage('clicked', '*');
});
btn4.addEventListener('click', () => {
pressed.textContent = 'true';
window.parent.postMessage('clicked', '*');
});
btn5.addEventListener('mouseup', () => {
pressed.textContent = 'true';
window.parent.postMessage('clicked', '*');
});
</script>
</body>
</html>