Skip to content

Instantly share code, notes, and snippets.

@cwg999
Last active August 2, 2017 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwg999/0d0e1105954d6aec181cdd1411a51c13 to your computer and use it in GitHub Desktop.
Save cwg999/0d0e1105954d6aec181cdd1411a51c13 to your computer and use it in GitHub Desktop.
await delay
// 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