async_retry_fzlxtech
v1.0.3
Published
A package to retry a failed async request.
Downloads
6
Maintainers
Readme
async-retry
Simply a npm package that helps to retry your async function.
How to use
- Install by npm.
npm i async_retry_fzlxtech
- An example how to use
const retry = require('async_retry_fzlxtech');
let count = 0;
const fn = () => new Promise((resolve, reject) => {
count++;
if (count === 3) {
resolve('success');
} else {
reject(new Error('failed'));
}
});
const result = await retry(fn, { retries: 5, delay: 100 });