Last active
September 29, 2018 08:06
-
-
Save ilyachenko/54e84fa5b0721bcf508a to your computer and use it in GitHub Desktop.
Javascript synchronous sleep function
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 sleep(delay) { | |
var startTime = new Date(); | |
var endTime = null; | |
do { | |
endTime = new Date(); | |
} while ((endTime - startTime)); | |
} |
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
very wrong... delay is not even used.