@types/async-retry
- Version 1.4.8
- Published
- 5.91 kB
- 1 dependency
- MIT license
Install
npm i @types/async-retry
yarn add @types/async-retry
pnpm add @types/async-retry
Overview
TypeScript definitions for async-retry
Index
Functions
function AsyncRetry
AsyncRetry: <TRet>( fn: AsyncRetry.RetryFunction<TRet>, opts?: AsyncRetry.Options) => Promise<TRet>;
Retrying made simple, easy, and async.
Example 1
import retry = require('async-retry'); import fetch from 'node-fetch';
await retry( async (bail) => { // if anything throws, we retry const res = await fetch('https://google.com');
if (403 === res.status) { // don't retry upon 403 bail(new Error('Unauthorized')); return; }
const data = await res.text(); return data.substr(0, 500); }, { retries: 5, } );
Interfaces
Type Aliases
type RetryFunction
type RetryFunction<TRet> = ( bail: (e: Error) => void, attempt: number) => TRet | Promise<TRet>;
Parameter bail
A function you can invoke to abort the retrying (bail).
Parameter attempt
The attempt number. The absolute first attempt (before any retries) is
1
.
Package Files (1)
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/async-retry
.
- Markdown[](https://www.jsdocs.io/package/@types/async-retry)
- HTML<a href="https://www.jsdocs.io/package/@types/async-retry"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 982 ms. - Missing or incorrect documentation? Open an issue for this package.