Created
February 22, 2017 08:30
-
-
Save chhantyal/a3eab380a7790af992af2d9f564362fc to your computer and use it in GitHub Desktop.
Javascript/NodeJS sleep function. Javascript doesn't have built-in sleep function, thus this is workaround.
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(milliSeconds) { | |
var startTime = new Date().getTime(); | |
while (new Date().getTime() < startTime + milliSeconds); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment