-
Notifications
You must be signed in to change notification settings - Fork 3k
/
index.d.ts
71 lines (63 loc) · 2.01 KB
/
index.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
export declare const ajax: AjaxCreationMethod;
export interface AjaxConfig {
async?: boolean;
body?: any;
createXHR?: () => XMLHttpRequest;
crossDomain?: boolean;
headers?: Readonly<Record<string, any>>;
includeDownloadProgress?: boolean;
includeUploadProgress?: boolean;
method?: string;
password?: string;
progressSubscriber?: PartialObserver<ProgressEvent>;
queryParams?: string | URLSearchParams | Record<string, string | number | boolean | string[] | number[] | boolean[]> | [string, string | number | boolean | string[] | number[] | boolean[]][];
responseType?: XMLHttpRequestResponseType;
timeout?: number;
url: string;
user?: string;
withCredentials?: boolean;
xsrfCookieName?: string;
xsrfHeaderName?: string;
}
export declare type AjaxDirection = 'upload' | 'download';
export interface AjaxError extends Error {
request: AjaxRequest;
response: any;
responseType: XMLHttpRequestResponseType;
status: number;
xhr: XMLHttpRequest;
}
export declare const AjaxError: AjaxErrorCtor;
export interface AjaxRequest {
async: boolean;
body?: any;
crossDomain: boolean;
headers: Readonly<Record<string, any>>;
method: string;
password?: string;
responseType: XMLHttpRequestResponseType;
timeout: number;
url: string;
user?: string;
withCredentials: boolean;
}
export declare class AjaxResponse<T> {
readonly loaded: number;
readonly originalEvent: ProgressEvent;
readonly request: AjaxRequest;
readonly response: T;
readonly responseHeaders: Record<string, string>;
readonly responseType: XMLHttpRequestResponseType;
readonly status: number;
readonly total: number;
readonly type: AjaxResponseType;
readonly xhr: XMLHttpRequest;
constructor(
originalEvent: ProgressEvent,
xhr: XMLHttpRequest,
request: AjaxRequest,
type?: AjaxResponseType);
}
export interface AjaxTimeoutError extends AjaxError {
}
export declare const AjaxTimeoutError: AjaxTimeoutErrorCtor;