Last active
August 2, 2017 17:45
-
-
Save cwg999/0d0e1105954d6aec181cdd1411a51c13 to your computer and use it in GitHub Desktop.
await delay
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 | |
const delay = time => new Promise(res=>setTimeout(()=>res(),time)); | |
// Usage | |
await delay(2000); | |
let results = await foo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment