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