Created
July 15, 2011 14:24
-
-
Save jussi-kalliokoski/1084782 to your computer and use it in GitHub Desktop.
Small sleep function for 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
/** | |
* Does nothing (useful) for a specified time. | |
* | |
* @param {Uint} The time to sleep, in milliseconds. | |
*/ | |
function sleep(t){var m=+new Date+t;while(+new Date<m);} | |
// Please note that this is a pattern that is hardly useful, never advisable and a bit intensive. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment