Skip to content

Instantly share code, notes, and snippets.

@ilyachenko
Last active September 29, 2018 08:06
Show Gist options
  • Save ilyachenko/54e84fa5b0721bcf508a to your computer and use it in GitHub Desktop.
Save ilyachenko/54e84fa5b0721bcf508a to your computer and use it in GitHub Desktop.
Javascript synchronous sleep function
function sleep(delay) {
var startTime = new Date();
var endTime = null;
do {
endTime = new Date();
} while ((endTime - startTime));
}
@channgli
Copy link

do not do like this, drop-dead halt will not make the page can not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment