Created
January 29, 2018 23:20
-
-
Save Balamir/43dce5fe7b415d303ff6adadff58b22b to your computer and use it in GitHub Desktop.
JS Sleep with Promise
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
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
return await sleep(300).then(() => ({ console.log('waited 300ms'); }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment