Created
March 5, 2019 19:44
-
-
Save shadowcodex/766565f22f648047b2e8e2c7858146a6 to your computer and use it in GitHub Desktop.
sleep function using async/await
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
const sleep = (time) => { | |
return new Promise(resolve => { | |
setTimeout(resolve, time); | |
}); | |
} | |
await sleep(1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment