Created
November 14, 2020 17:16
-
-
Save ilyahuman/3c1cfe9814b490b497eac35d2b05e116 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function will wait until needed time but will block your eventloop | |
function sleep(time = 0) { | |
const wakeUpTime = Date.now() + time | |
while (Date.now() < wakeUpTime) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment