Retryable promise utility for the browser
There are a few similar modules out there, mostly abandonware, few with tests.
Install the module:
npm install --save-dev @beyonk/promise-retry
Use it in your code:
// defaults
const retries = 5
const intervalBetweenRetries = 1000
const myFunction = async function () { ...blah }
retry(
myFunction,
retries,
intervalBetweenRetries
)
npm test
- Code adapted from this gist, and corrected.