Skip to content

Commit 6edfb62

Browse files
committed
Blocking the main Thread that currupts the output of settimeout
1 parent fccf197 commit 6edfb62

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

blockmainthrd.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,13 @@ console.log("Started");
66
}, 5000);
77

88
console.log("Ended");
9+
10+
// Block Main Thread
11+
12+
let startdt = new Date().getTime();
13+
let enddt = startdt;
14+
while(enddt < startdt+10000)
15+
{
16+
enddt = new Date().getTime();
17+
}
18+
console.log("This is before settimeout");

0 commit comments

Comments
 (0)