Skip to content

Instantly share code, notes, and snippets.

@adw0rd
Created June 19, 2018 11:25
Show Gist options
  • Save adw0rd/b145d9dbe9337a9968a7f2de838a1ca5 to your computer and use it in GitHub Desktop.
Save adw0rd/b145d9dbe9337a9968a7f2de838a1ca5 to your computer and use it in GitHub Desktop.
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 }
@adw0rd
Copy link
Author

adw0rd commented Jun 19, 2018

((start, seconds) => {while (((new Date) - start) / 1000 < seconds) {}})(new Date, 10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment