-
Notifications
You must be signed in to change notification settings - Fork 0
/
delay-test.html
54 lines (48 loc) · 1.66 KB
/
delay-test.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
<!-- For testing if x delay is perceptible. -->
<!DOCTYPE html>
<html>
<head>
<title>50ms Delay Example</title>
</head>
<body>
<div style="display: flex; gap: 1rem">
<div>
<button id="delayedAddButton">Add Delayed Item</button>
<ul id="delayItemList">
<!-- Items will be added here -->
</ul>
</div>
<div>
<button id="immediateAddButton">Add Item Immediately</button>
<ul id="noDelayItemList">
<!-- Items will be added here -->
</ul>
</div>
</div>
<script>
const delayedAddButton = document.getElementById("delayedAddButton");
const immediateAddButton = document.getElementById("immediateAddButton");
const delayItemList = document.getElementById("delayItemList");
const noDelayItemList = document.getElementById("noDelayItemList");
// Add click event listener to the button
delayedAddButton.addEventListener("click", () => {
// Delay for 50 milliseconds
setTimeout(() => {
// Create a new list item
const newItem = document.createElement("li");
newItem.textContent = "New Item";
// Add the new item to the list
delayItemList.appendChild(newItem);
// test delay here.
}, 50);
});
immediateAddButton.addEventListener("click", () => {
// Create a new list item
const newItem = document.createElement("li");
newItem.textContent = "New Item";
// Add the new item to the list
noDelayItemList.appendChild(newItem);
});
</script>
</body>
</html>