Created
March 2, 2020 23:26
-
-
Save JamesIgoe/ed0d6c94150b740b4401d959820c5496 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
var sleep = function sleep(ms) { | |
var date = Date.now(); | |
var currentDate = null; | |
do { | |
currentDate = Date.now(); | |
} while (currentDate - date < ms); | |
}; | |
var sleepPromise = function newSleep(ms) | |
{ | |
return new Promise(function (resolve) { | |
setTimeout(resolve, ms); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment