Skip to content

Instantly share code, notes, and snippets.

@lamkent00
Forked from eteeselink/delay.js
Created December 5, 2018 12:55
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 lamkent00/72622ea1ba0d5401ee6cdca0c8030a86 to your computer and use it in GitHub Desktop.
Save lamkent00/72622ea1ba0d5401ee6cdca0c8030a86 to your computer and use it in GitHub Desktop.
ES7 async/await version of setTimeout
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
async function something() {
console.log("this might take some time....");
await delay(5000);
console.log("done!")
}
something();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment