Skip to content

Instantly share code, notes, and snippets.

@rimiti

rimiti/delay.md

Last active Oct 18, 2017
Embed
What would you like to do?
Add delay (ms) between promises

If you wants to add a delay between two promise:

/**
 * @description Add delay (ms) between promises
 * @param delay
 * @return {Promise}
 */
wait(delay) {
  wait(delay) {
    return new Promise((resolve) => {
      setTimeout(() => resolve(), delay)
    })
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.