1const sleep = (milliseconds) => {
2 return new Promise(resolve => setTimeout(resolve, milliseconds))
3}
4
5/*Use like so*/
6
7async function timeSensativeAction(){ //must be async func
8 //do something here
9 await sleep(5000) //wait 5 seconds
10 //continue on...
11}
12
13
1#will sleep the current corutien for set numner of seconds
2import asyncio
3await asyncio.sleep(1)
4
5
1let ms = 10000;
2Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
3
4// exactly sleep in python or in bash