Created
November 6, 2016 09:09
-
-
Save netsi1964/74015998b150daef29075461f66ab220 to your computer and use it in GitHub Desktop.
waitFor lets you pause code execution
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 waitFor(ms, cb) { | |
var waitTill = new Date(new Date().getTime() + ms); | |
while(waitTill > new Date()){}; | |
if (cb) { | |
cb() | |
} else { | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment