Created
June 19, 2018 11:25
-
-
Save adw0rd/b145d9dbe9337a9968a7f2de838a1ca5 to your computer and use it in GitHub Desktop.
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 (seconds) { | |
let start = new Date; | |
while (((new Date) - start) / 1000 < seconds) {} | |
} | |
// console.log('Start', new Date) | |
// sleep(5) | |
// console.log('End', new Date) | |
module.exports = { sleep } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
((start, seconds) => {while (((new Date) - start) / 1000 < seconds) {}})(new Date, 10)