UNPKG

813 BTypeScriptView Raw
1export interface BackoffOptions {
2 initialDelay?: number;
3 multiplier?: number;
4 jitter?: number;
5 maxDelay?: number;
6}
7export declare class BackoffTimeout {
8 private callback;
9 private initialDelay;
10 private multiplier;
11 private maxDelay;
12 private jitter;
13 private nextDelay;
14 private timerId;
15 private running;
16 private hasRef;
17 constructor(callback: () => void, options?: BackoffOptions);
18 /**
19 * Call the callback after the current amount of delay time
20 */
21 runOnce(): void;
22 /**
23 * Stop the timer. The callback will not be called until `runOnce` is called
24 * again.
25 */
26 stop(): void;
27 /**
28 * Reset the delay time to its initial value.
29 */
30 reset(): void;
31 isRunning(): boolean;
32 ref(): void;
33 unref(): void;
34}