forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
q-retry.d.ts
39 lines (34 loc) · 2.16 KB
/
q-retry.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Type definitions for q-retry
// Project: https://github.com/vilic/q-retry
// Definitions by: VILIC VANE <https://github.com/vilic>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../q/Q.d.ts" />
declare module Q {
export interface IRetryOptions {
limit?: number;
interval?: number;
maxInterval?: number;
intervalMultiplier?: number;
}
export function retry<U>(process: () => IPromise<U>, onFail: (reason: any, retries: number) => void, limit: number): Promise<U>;
export function retry<U>(process: () => IPromise<U>, onFail: (reason: any, retries: number) => void, options?: IRetryOptions): Promise<U>;
export function retry<U>(process: () => IPromise<U>, limit: number): Promise<U>;
export function retry<U>(process: () => IPromise<U>, options?: IRetryOptions): Promise<U>;
export function retry<U>(process: () => U, onFail: (reason: any, retries: number) => void, limit: number): Promise<U>;
export function retry<U>(process: () => U, onFail: (reason: any, retries: number) => void, options?: IRetryOptions): Promise<U>;
export function retry<U>(process: () => U, limit: number): Promise<U>;
export function retry<U>(process: () => U, options?: IRetryOptions): Promise<U>;
interface Promise<T> {
retry<U>(process: (value: T) => IPromise<U>, onFail: (reason: any, retries: number) => void, limit: number): Promise<U>;
retry<U>(process: (value: T) => IPromise<U>, onFail: (reason: any, retries: number) => void, options?: IRetryOptions): Promise<U>;
retry<U>(process: (value: T) => IPromise<U>, limit: number): Promise<U>;
retry<U>(process: (value: T) => IPromise<U>, options?: IRetryOptions): Promise<U>;
retry<U>(process: (value: T) => U, onFail: (reason: any, retries: number) => void, limit: number): Promise<U>;
retry<U>(process: (value: T) => U, onFail: (reason: any, retries: number) => void, options?: IRetryOptions): Promise<U>;
retry<U>(process: (value: T) => U, limit: number): Promise<U>;
retry<U>(process: (value: T) => U, options?: IRetryOptions): Promise<U>;
}
}
declare module "q-retry" {
export = Q;
}