Skip to content

Instantly share code, notes, and snippets.

@davidbreyer
Created March 22, 2016 20:15
Show Gist options
  • Save davidbreyer/43da591e61532940fe5c to your computer and use it in GitHub Desktop.
Save davidbreyer/43da591e61532940fe5c to your computer and use it in GitHub Desktop.
Sleep Function for JavaScript found at http://www.phpied.com/sleep-in-javascript/
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment