Last active
February 26, 2024 06:16
-
-
Save canalun/487c9ce5e95da0a9c5a422829b2307a5 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
const sleep = (ms) => { | |
const now = performance.now() | |
while (performance.now() - now < ms) { | |
// wait | |
} | |
} | |
(function setSleepRepeatedly() { | |
Promise.resolve().then(() => { | |
sleep(3000) | |
setTimeout(setSleepRepeatedly, Math.random()*2000) | |
}) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment