Skip to content

Instantly share code, notes, and snippets.

@senthilmpro
Created May 3, 2018 17:11
Show Gist options
  • Save senthilmpro/2978ca176330c306bfc2ba21b6728644 to your computer and use it in GitHub Desktop.
Save senthilmpro/2978ca176330c306bfc2ba21b6728644 to your computer and use it in GitHub Desktop.
Asynchronously (await) delay timer
function delay(timeout) {
return new Promise((resolve) => {
setTimeout(resolve, timeout);
});
}
/**
* then use it like this.
* async function f1() {
* await delay(3000);
* }
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment