UNPKG

@aptpod/iscp-ts

Version:

iSCP 2.0 client library for TypeScript

32 lines (31 loc) 787 B
export interface JitterConfig { ratioCreator: () => number; min: number; max: number; } export interface ExponentialBackoffConfig<T> { run: () => Promise<T>; signal: AbortSignal; baseTimeoutMs: number; maxTimeoutMs: number; jitter: Jitter; numOfAttempts: number; } export interface OnBeforeRetryParams { retryCount: number; timeoutMs: number; error: Error; } export declare class AbortedError extends Error { } export declare class Jitter { #private; constructor(config: JitterConfig); create(): number; } export declare class ExponentialBackoff<T> { #private; onBeforeRetry: (params: OnBeforeRetryParams) => void; constructor(config: ExponentialBackoffConfig<T>); start(): Promise<T | AbortedError | Error>; }