Created
June 1, 2018 21:13
-
-
Save faneder/5e5d78d5e0a828177442a81626768785 to your computer and use it in GitHub Desktop.
ES7 async/await of setTimeOut
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 = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
const delay = async (time) => { | |
console.log(`please wait ${time}.....`); | |
await sleep(time); | |
console.log("done~ all good!!") | |
} | |
delay(5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment