Created
December 29, 2023 11:31
-
-
Save rafaelmaeuer/35234f8d5ba967c2a522b4a1ba0a532b to your computer and use it in GitHub Desktop.
https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep/39914235#39914235
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
var sleepSetTimeout_ctrl; | |
function sleep(ms) { | |
clearInterval(sleepSetTimeout_ctrl); | |
return new Promise(resolve => sleepSetTimeout_ctrl = setTimeout(resolve, ms)); | |
} | |
await sleep(<duration>); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment