forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsdeferred.d.ts
83 lines (63 loc) · 2.54 KB
/
jsdeferred.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Type definitions for JSDeferred
// Project: https://github.com/cho45/jsdeferred
// Definitions by: Daisuke Mino <https://github.com/minodisk>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
interface Loop {
begin?: number;
end?: number;
step?: number;
}
interface ConnectOption {
target: any;
args?: any[];
ok?: number;
ng?: number;
}
interface RetryOption {
wait: number;
}
interface DeferredizedFunction { (...arg: any[]): Deferred; }
interface DeferredizedFunctionWithNumber { (n: number): Deferred; }
interface FunctionWithNumber { (i: number, o?: any): any; }
interface ErrorCallback { (d: Deferred, ...args: any[]): any; }
declare class Deferred {
static methods: string[];
static isDeferred(obj: any): boolean;
static next(fun: Function): Deferred;
static chain(...args: any[]): Deferred;
static wait(n: number): Deferred;
static call(fun?: Function, ...args: any[]): Deferred;
static parallel(dl: any): Deferred;
static earlier(dl: any): Deferred;
static loop(n: number, fun: FunctionWithNumber): Deferred;
static loop(n: Loop, fun: FunctionWithNumber): Deferred;
static repeat(n: number, fun: FunctionWithNumber): Deferred;
static register(name: string, fun: DeferredizedFunction): void;
static connect(funo: any, options: string): DeferredizedFunction;
static connect(funo: Function, options?: ConnectOption): DeferredizedFunction;
static retry(retryCount: number, funcDeferred: DeferredizedFunctionWithNumber, options?: RetryOption): Deferred;
static define(obj?: any, list?: string[]): any;
constructor();
next(fun: Function): Deferred;
wait(n: number): Deferred;
error(fun: ErrorCallback): Deferred;
call(val?: any): Deferred;
fail(err: any): Deferred;
cancel(): Deferred;
parallel(dl: any): Deferred;
loop(n: number, fun: FunctionWithNumber): Deferred;
loop(n: Loop, fun: FunctionWithNumber): Deferred;
}
interface JQueryXHR {
next(fun: Function): Deferred;
}
declare function chain(...args: any[]): Deferred;
declare function wait(n: number): Deferred;
declare function call(fun?: Function, ...args: any[]): Deferred;
declare function parallel(dl: any): Deferred;
declare function earlier(dl: any): Deferred;
declare function loop(n: number, fun: FunctionWithNumber): Deferred;
declare function loop(n: Loop, fun: FunctionWithNumber): Deferred;
declare function repeat(n: number, fun: FunctionWithNumber): Deferred;
declare function next(fun: Function): Deferred;