@thepassle/app-tools
Version:
Collection of tools I regularly use to build apps. Maybe they're useful to somebody else. Maybe not. Most of these are thin wrappers around native API's, like the native `<dialog>` element, `fetch` API, and `URLPattern`.
13 lines (12 loc) • 549 B
TypeScript
/**
* @param {object} options
* @param {number} [options.maxRetries=5] - Maximum number of retries
* @param {number[]} [options.delays=[1000, 2000, 4000, 8000, 16000]] - Delay in ms per retry attempt
* @param {(e: Error) => boolean} [options.shouldRetry] - Optional predicate to control which errors are retried
* @returns {import('../index.js').Plugin}
*/
export function retry({ maxRetries, delays, shouldRetry, }?: {
maxRetries?: number;
delays?: number[];
shouldRetry?: (e: Error) => boolean;
}): import('../index.js').Plugin;