Skip to content

Instantly share code, notes, and snippets.

@yairEO
Last active January 14, 2021 14:58
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 yairEO/9fd8ce91fa646b87f816e5ee728baddc to your computer and use it in GitHub Desktop.
Save yairEO/9fd8ce91fa646b87f816e5ee728baddc to your computer and use it in GitHub Desktop.
promise javascript delay
const delay = ms => new Promise(resolve => setTimeout(resolve, ms))
@yairEO
Copy link
Author

yairEO commented Dec 26, 2019

Usage

async function(){
  await delay(1000)
  ..do stuff..
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment