@sapphire/utilities
Version:
Common JavaScript utilities for the Sapphire Community
13 lines (10 loc) • 538 B
text/typescript
import { Awaitable } from './types.cjs';
/**
* Asynchronously calls the callback function until it either succeeds or it runs out of retries.
* For a synchronous variant, see [retrySync](./retrySync.d.ts).
* @param cb The function to be retried is passed in as a callback function.
* @param retries The number of retries is also passed in as a parameter. Minimum of 0.
* @returns The result of the callback function is returned.
*/
declare function retry<T>(cb: () => Awaitable<T>, retries: number): Promise<T>;
export { retry };