Created
March 1, 2015 21:22
-
-
Save khajavi/e53ec2d9fb30ad3c86f0 to your computer and use it in GitHub Desktop.
sleep in javascript
This file contains hidden or 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(time, callback) { | |
var stop = new Date().getTime(); | |
while (new Date().getTime() < stop + time) { | |
; | |
} | |
callback(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment