mphttpx 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1012 -838
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.d.ts +128 -180
- package/dist/index.esm.js +1012 -838
- package/dist/index.esm.min.js +1 -1
- package/dist/types/AbortSignalP.d.ts +7 -3
- package/dist/types/BlobP.d.ts +4 -2
- package/dist/types/BodyP.d.ts +5 -10
- package/dist/types/EventP.d.ts +21 -11
- package/dist/types/EventTargetP.d.ts +3 -4
- package/dist/types/FileReaderP.d.ts +9 -9
- package/dist/types/FormDataP.d.ts +5 -3
- package/dist/types/HeadersP.d.ts +4 -2
- package/dist/types/ProgressEventP.d.ts +5 -3
- package/dist/types/RequestP.d.ts +3 -3
- package/dist/types/ResponseP.d.ts +3 -2
- package/dist/types/TextDecoderP.d.ts +4 -2
- package/dist/types/URLSearchParamsP.d.ts +3 -2
- package/dist/types/XMLHttpRequestEventTargetP.d.ts +12 -9
- package/dist/types/XMLHttpRequestP.d.ts +25 -23
- package/dist/types/isPolyfill.d.ts +2 -1
- package/dist/types/request.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,13 +13,13 @@ declare const TextEncoderE: {
|
|
|
13
13
|
prototype: TextEncoder;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
declare const state$
|
|
16
|
+
declare const state$h: unique symbol;
|
|
17
17
|
declare class TextDecoderP implements TextDecoder {
|
|
18
18
|
constructor(utfLabel?: string, { fatal, ignoreBOM }?: {
|
|
19
19
|
fatal?: boolean | undefined;
|
|
20
20
|
ignoreBOM?: boolean | undefined;
|
|
21
21
|
});
|
|
22
|
-
[state$
|
|
22
|
+
[state$h]: TextDecoderState;
|
|
23
23
|
get encoding(): string;
|
|
24
24
|
get fatal(): boolean;
|
|
25
25
|
get ignoreBOM(): boolean;
|
|
@@ -32,11 +32,13 @@ declare class TextDecoderP implements TextDecoder {
|
|
|
32
32
|
hierarchy: string[];
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
+
declare const _bomSeen: unique symbol;
|
|
36
|
+
declare const _partial: unique symbol;
|
|
35
37
|
declare class TextDecoderState {
|
|
36
38
|
fatal: boolean;
|
|
37
39
|
ignoreBOM: boolean;
|
|
38
|
-
_bomSeen: boolean;
|
|
39
|
-
_partial: number[];
|
|
40
|
+
[_bomSeen]: boolean;
|
|
41
|
+
[_partial]: number[];
|
|
40
42
|
}
|
|
41
43
|
type TAllowSharedBufferSource = NonNullable<Parameters<TextDecoder["decode"]>[0]>;
|
|
42
44
|
declare const TextDecoderE: {
|
|
@@ -44,7 +46,7 @@ declare const TextDecoderE: {
|
|
|
44
46
|
prototype: TextDecoder;
|
|
45
47
|
};
|
|
46
48
|
|
|
47
|
-
declare const state$
|
|
49
|
+
declare const state$g: unique symbol;
|
|
48
50
|
|
|
49
51
|
declare class EventP implements Event {
|
|
50
52
|
static readonly NONE = 0;
|
|
@@ -52,7 +54,7 @@ declare class EventP implements Event {
|
|
|
52
54
|
static readonly AT_TARGET = 2;
|
|
53
55
|
static readonly BUBBLING_PHASE = 3;
|
|
54
56
|
constructor(type: string, eventInitDict?: EventInit);
|
|
55
|
-
[state$
|
|
57
|
+
[state$g]: EventState;
|
|
56
58
|
get type(): string;
|
|
57
59
|
get bubbles(): boolean;
|
|
58
60
|
get cancelable(): boolean;
|
|
@@ -65,16 +67,17 @@ declare class EventP implements Event {
|
|
|
65
67
|
readonly AT_TARGET = 2;
|
|
66
68
|
readonly BUBBLING_PHASE = 3;
|
|
67
69
|
get srcElement(): EventTarget | null;
|
|
68
|
-
cancelBubble: boolean;
|
|
70
|
+
get cancelBubble(): boolean;
|
|
71
|
+
set cancelBubble(value: boolean);
|
|
69
72
|
get defaultPrevented(): boolean;
|
|
70
73
|
get returnValue(): boolean;
|
|
71
74
|
set returnValue(value: boolean);
|
|
72
75
|
get isTrusted(): boolean;
|
|
73
76
|
get timeStamp(): number;
|
|
74
77
|
composedPath(): EventTarget[];
|
|
75
|
-
initEvent
|
|
76
|
-
preventDefault
|
|
77
|
-
stopImmediatePropagation
|
|
78
|
+
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
|
|
79
|
+
preventDefault(): void;
|
|
80
|
+
stopImmediatePropagation(): void;
|
|
78
81
|
stopPropagation(): void;
|
|
79
82
|
toString(): string;
|
|
80
83
|
get isPolyfill(): {
|
|
@@ -82,8 +85,14 @@ declare class EventP implements Event {
|
|
|
82
85
|
hierarchy: string[];
|
|
83
86
|
};
|
|
84
87
|
}
|
|
88
|
+
declare const _TimeStamp: unique symbol;
|
|
89
|
+
declare const _isTrusted: unique symbol;
|
|
90
|
+
declare const _passive: unique symbol;
|
|
91
|
+
declare const _dispatched: unique symbol;
|
|
92
|
+
declare const _preventDefaultCalled: unique symbol;
|
|
93
|
+
declare const _stopImmediatePropagationCalled: unique symbol;
|
|
85
94
|
declare class EventState {
|
|
86
|
-
static
|
|
95
|
+
static [_TimeStamp]: number;
|
|
87
96
|
type: string;
|
|
88
97
|
bubbles: boolean;
|
|
89
98
|
cancelable: boolean;
|
|
@@ -91,14 +100,15 @@ declare class EventState {
|
|
|
91
100
|
target: EventTarget | null;
|
|
92
101
|
currentTarget: EventTarget | null;
|
|
93
102
|
eventPhase: number;
|
|
103
|
+
cancelBubble: boolean;
|
|
94
104
|
defaultPrevented: boolean;
|
|
95
105
|
returnValue: boolean;
|
|
96
|
-
isTrusted: boolean;
|
|
97
106
|
timeStamp: number;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
[_isTrusted]: boolean;
|
|
108
|
+
[_passive]: boolean;
|
|
109
|
+
[_dispatched]: boolean;
|
|
110
|
+
[_preventDefaultCalled]: boolean;
|
|
111
|
+
[_stopImmediatePropagationCalled]: boolean;
|
|
102
112
|
}
|
|
103
113
|
declare const EventE: {
|
|
104
114
|
new (type: string, eventInitDict?: EventInit): Event;
|
|
@@ -109,11 +119,11 @@ declare const EventE: {
|
|
|
109
119
|
readonly BUBBLING_PHASE: 3;
|
|
110
120
|
};
|
|
111
121
|
|
|
112
|
-
declare const state$
|
|
122
|
+
declare const state$f: unique symbol;
|
|
113
123
|
|
|
114
124
|
declare class EventTargetP implements EventTarget {
|
|
115
125
|
constructor();
|
|
116
|
-
[state$
|
|
126
|
+
[state$f]: EventTargetState;
|
|
117
127
|
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
|
|
118
128
|
dispatchEvent(event: Event): boolean;
|
|
119
129
|
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
|
|
@@ -123,15 +133,13 @@ declare class EventTargetP implements EventTarget {
|
|
|
123
133
|
hierarchy: string[];
|
|
124
134
|
};
|
|
125
135
|
}
|
|
136
|
+
declare const _executors: unique symbol;
|
|
126
137
|
declare class EventTargetState {
|
|
127
138
|
constructor(target: EventTargetP);
|
|
128
139
|
target: EventTargetP;
|
|
129
|
-
|
|
130
|
-
fire(event: EventP): boolean;
|
|
131
|
-
reply(signal: AbortSignal, executor: Executor): void;
|
|
140
|
+
[_executors]: Executor[];
|
|
132
141
|
}
|
|
133
142
|
declare class Executor {
|
|
134
|
-
static extract(cb: EventListenerOrEventListenerObject | null): EventListener | null;
|
|
135
143
|
constructor(type: string, callback: EventListenerOrEventListenerObject | null);
|
|
136
144
|
type: string;
|
|
137
145
|
callback: EventListener | null;
|
|
@@ -143,10 +151,10 @@ declare const EventTargetE: {
|
|
|
143
151
|
prototype: EventTarget;
|
|
144
152
|
};
|
|
145
153
|
|
|
146
|
-
declare const state$
|
|
154
|
+
declare const state$e: unique symbol;
|
|
147
155
|
declare class CustomEventP<T> extends EventP implements CustomEvent {
|
|
148
156
|
constructor(type: string, eventInitDict?: CustomEventInit<T>);
|
|
149
|
-
[state$
|
|
157
|
+
[state$e]: CustomEventState;
|
|
150
158
|
get detail(): T;
|
|
151
159
|
initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: T): void;
|
|
152
160
|
toString(): string;
|
|
@@ -163,10 +171,10 @@ declare const CustomEventE: {
|
|
|
163
171
|
prototype: CustomEvent;
|
|
164
172
|
};
|
|
165
173
|
|
|
166
|
-
declare const state$
|
|
174
|
+
declare const state$d: unique symbol;
|
|
167
175
|
declare class ProgressEventP extends EventP implements ProgressEvent {
|
|
168
176
|
constructor(type: string, eventInitDict?: ProgressEventInit);
|
|
169
|
-
[state$
|
|
177
|
+
[state$d]: ProgressEventState;
|
|
170
178
|
get lengthComputable(): boolean;
|
|
171
179
|
get loaded(): number;
|
|
172
180
|
get total(): number;
|
|
@@ -177,18 +185,20 @@ declare class ProgressEventP extends EventP implements ProgressEvent {
|
|
|
177
185
|
};
|
|
178
186
|
}
|
|
179
187
|
declare class ProgressEventState {
|
|
180
|
-
lengthComputable: boolean;
|
|
181
|
-
loaded: number;
|
|
182
|
-
total: number;
|
|
188
|
+
lengthComputable: boolean | (() => boolean);
|
|
189
|
+
loaded: number | (() => number);
|
|
190
|
+
total: number | (() => number);
|
|
183
191
|
}
|
|
184
192
|
declare const ProgressEventE: {
|
|
185
193
|
new (type: string, eventInitDict?: ProgressEventInit): ProgressEvent;
|
|
186
194
|
prototype: ProgressEvent;
|
|
187
195
|
};
|
|
188
196
|
|
|
197
|
+
declare const state$c: unique symbol;
|
|
198
|
+
|
|
189
199
|
declare class BlobP implements Blob {
|
|
190
200
|
constructor(blobParts?: BlobPart[], options?: BlobPropertyBag);
|
|
191
|
-
[state$
|
|
201
|
+
[state$c]: BlobState;
|
|
192
202
|
get size(): number;
|
|
193
203
|
get type(): string;
|
|
194
204
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
@@ -202,11 +212,12 @@ declare class BlobP implements Blob {
|
|
|
202
212
|
hierarchy: string[];
|
|
203
213
|
};
|
|
204
214
|
}
|
|
215
|
+
declare const _u8array: unique symbol;
|
|
205
216
|
declare class BlobState {
|
|
206
217
|
constructor(buffer: TUint8ArrayOfArrayBuffer);
|
|
207
218
|
size: number;
|
|
208
219
|
type: string;
|
|
209
|
-
_u8array: TUint8ArrayOfArrayBuffer;
|
|
220
|
+
[_u8array]: TUint8ArrayOfArrayBuffer;
|
|
210
221
|
}
|
|
211
222
|
type TUint8ArrayOfArrayBuffer = ReturnType<TextEncoder["encode"]>;
|
|
212
223
|
declare const BlobE: {
|
|
@@ -214,10 +225,10 @@ declare const BlobE: {
|
|
|
214
225
|
prototype: Blob;
|
|
215
226
|
};
|
|
216
227
|
|
|
217
|
-
declare const state$
|
|
228
|
+
declare const state$b: unique symbol;
|
|
218
229
|
declare class FileP extends BlobP implements File {
|
|
219
230
|
constructor(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag);
|
|
220
|
-
[state$
|
|
231
|
+
[state$b]: FileState;
|
|
221
232
|
get lastModified(): number;
|
|
222
233
|
get name(): string;
|
|
223
234
|
get webkitRelativePath(): string;
|
|
@@ -236,13 +247,13 @@ declare const FileE: {
|
|
|
236
247
|
prototype: File;
|
|
237
248
|
};
|
|
238
249
|
|
|
239
|
-
declare const state$
|
|
250
|
+
declare const state$a: unique symbol;
|
|
240
251
|
declare class FileReaderP extends EventTargetP implements FileReader {
|
|
241
252
|
static readonly EMPTY = 0;
|
|
242
253
|
static readonly LOADING = 1;
|
|
243
254
|
static readonly DONE = 2;
|
|
244
255
|
constructor();
|
|
245
|
-
[state$
|
|
256
|
+
[state$a]: FileReaderState;
|
|
246
257
|
get readyState(): 0 | 1 | 2;
|
|
247
258
|
get result(): string | ArrayBuffer | null;
|
|
248
259
|
readonly EMPTY = 0;
|
|
@@ -272,27 +283,27 @@ declare class FileReaderP extends EventTargetP implements FileReader {
|
|
|
272
283
|
hierarchy: string[];
|
|
273
284
|
};
|
|
274
285
|
}
|
|
286
|
+
declare const _handlers$3: unique symbol;
|
|
275
287
|
declare class FileReaderState {
|
|
276
288
|
constructor(target: FileReaderP);
|
|
277
289
|
target: FileReaderP;
|
|
278
290
|
readyState: FileReader["readyState"];
|
|
279
291
|
result: string | ArrayBuffer | null;
|
|
280
292
|
error: DOMException | null;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
293
|
+
[_handlers$3]: {
|
|
294
|
+
onabort: (ev: ProgressEvent<FileReader>) => void;
|
|
295
|
+
onerror: (ev: ProgressEvent<FileReader>) => void;
|
|
296
|
+
onload: (ev: ProgressEvent<FileReader>) => void;
|
|
297
|
+
onloadend: (ev: ProgressEvent<FileReader>) => void;
|
|
298
|
+
onloadstart: (ev: ProgressEvent<FileReader>) => void;
|
|
299
|
+
onprogress: (ev: ProgressEvent<FileReader>) => void;
|
|
300
|
+
};
|
|
284
301
|
onabort: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
|
|
285
|
-
_onabort: (ev: ProgressEvent<FileReader>) => void;
|
|
286
302
|
onerror: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
|
|
287
|
-
_onerror: (ev: ProgressEvent<FileReader>) => void;
|
|
288
303
|
onload: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
|
|
289
|
-
_onload: (ev: ProgressEvent<FileReader>) => void;
|
|
290
304
|
onloadend: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
|
|
291
|
-
_onloadend: (ev: ProgressEvent<FileReader>) => void;
|
|
292
305
|
onloadstart: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
|
|
293
|
-
_onloadstart: (ev: ProgressEvent<FileReader>) => void;
|
|
294
306
|
onprogress: ((this: FileReader, ev: ProgressEvent<FileReader>) => any) | null;
|
|
295
|
-
_onprogress: (ev: ProgressEvent<FileReader>) => void;
|
|
296
307
|
}
|
|
297
308
|
declare const FileReaderE: {
|
|
298
309
|
new (): FileReader;
|
|
@@ -302,9 +313,11 @@ declare const FileReaderE: {
|
|
|
302
313
|
readonly DONE: 2;
|
|
303
314
|
};
|
|
304
315
|
|
|
316
|
+
declare const state$9: unique symbol;
|
|
317
|
+
|
|
305
318
|
declare class FormDataP implements FormData {
|
|
306
319
|
constructor(form?: HTMLFormElement, submitter?: HTMLElement | null);
|
|
307
|
-
[state$
|
|
320
|
+
[state$9]: FormDataState;
|
|
308
321
|
append(name: string, value: string | Blob, filename?: string): void;
|
|
309
322
|
delete(name: string): void;
|
|
310
323
|
get(name: string): FormDataEntryValue | null;
|
|
@@ -322,8 +335,9 @@ declare class FormDataP implements FormData {
|
|
|
322
335
|
hierarchy: string[];
|
|
323
336
|
};
|
|
324
337
|
}
|
|
338
|
+
declare const _formData: unique symbol;
|
|
325
339
|
declare class FormDataState {
|
|
326
|
-
|
|
340
|
+
[_formData]: [string, FormDataEntryValue][];
|
|
327
341
|
toBlob(): BlobP;
|
|
328
342
|
}
|
|
329
343
|
declare const FormDataE: {
|
|
@@ -331,6 +345,7 @@ declare const FormDataE: {
|
|
|
331
345
|
prototype: FormData;
|
|
332
346
|
};
|
|
333
347
|
|
|
348
|
+
declare const state$8: unique symbol;
|
|
334
349
|
declare class URLSearchParamsP implements URLSearchParams {
|
|
335
350
|
constructor(init?: string[][] | Record<string, string> | string | URLSearchParams);
|
|
336
351
|
[state$8]: URLSearchParamsState;
|
|
@@ -353,20 +368,23 @@ declare class URLSearchParamsP implements URLSearchParams {
|
|
|
353
368
|
hierarchy: string[];
|
|
354
369
|
};
|
|
355
370
|
}
|
|
371
|
+
declare const _urlspDict: unique symbol;
|
|
356
372
|
declare class URLSearchParamsState {
|
|
357
|
-
|
|
373
|
+
[_urlspDict]: Record<string, string[]>;
|
|
358
374
|
}
|
|
359
375
|
declare const URLSearchParamsE: {
|
|
360
376
|
new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
|
|
361
377
|
prototype: URLSearchParams;
|
|
362
378
|
};
|
|
363
379
|
|
|
380
|
+
declare const state$7: unique symbol;
|
|
381
|
+
|
|
364
382
|
declare class AbortSignalP extends EventTargetP implements AbortSignal {
|
|
365
383
|
static abort(reason?: any): AbortSignal;
|
|
366
384
|
static any(signals: AbortSignal[]): AbortSignal;
|
|
367
385
|
static timeout(milliseconds: number): AbortSignal;
|
|
368
386
|
constructor();
|
|
369
|
-
[state$
|
|
387
|
+
[state$7]: AbortSignalState;
|
|
370
388
|
get aborted(): boolean;
|
|
371
389
|
get reason(): any;
|
|
372
390
|
throwIfAborted(): void;
|
|
@@ -378,14 +396,16 @@ declare class AbortSignalP extends EventTargetP implements AbortSignal {
|
|
|
378
396
|
hierarchy: string[];
|
|
379
397
|
};
|
|
380
398
|
}
|
|
399
|
+
declare const _handlers$2: unique symbol;
|
|
381
400
|
declare class AbortSignalState {
|
|
382
401
|
constructor(target: AbortSignalP);
|
|
383
402
|
target: AbortSignalP;
|
|
384
403
|
aborted: boolean;
|
|
385
404
|
reason: any;
|
|
386
|
-
|
|
405
|
+
[_handlers$2]: {
|
|
406
|
+
onabort: (ev: Event) => void;
|
|
407
|
+
};
|
|
387
408
|
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
388
|
-
_onabort: (ev: Event) => void;
|
|
389
409
|
}
|
|
390
410
|
declare const AbortSignalE: {
|
|
391
411
|
new (): AbortSignal;
|
|
@@ -395,10 +415,10 @@ declare const AbortSignalE: {
|
|
|
395
415
|
timeout(milliseconds: number): AbortSignal;
|
|
396
416
|
};
|
|
397
417
|
|
|
398
|
-
declare const state$
|
|
418
|
+
declare const state$6: unique symbol;
|
|
399
419
|
declare class AbortControllerP implements AbortController {
|
|
400
420
|
constructor();
|
|
401
|
-
[state$
|
|
421
|
+
[state$6]: AbortControllerState;
|
|
402
422
|
get signal(): AbortSignal;
|
|
403
423
|
abort(reason?: any): void;
|
|
404
424
|
toString(): string;
|
|
@@ -415,9 +435,11 @@ declare const AbortControllerE: {
|
|
|
415
435
|
prototype: AbortController;
|
|
416
436
|
};
|
|
417
437
|
|
|
438
|
+
declare const state$5: unique symbol;
|
|
439
|
+
|
|
418
440
|
declare class XMLHttpRequestEventTargetP extends EventTargetP implements XMLHttpRequestEventTarget {
|
|
419
441
|
constructor();
|
|
420
|
-
[state$
|
|
442
|
+
[state$5]: XMLHttpRequestEventTargetState;
|
|
421
443
|
get onabort(): ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
|
|
422
444
|
set onabort(value: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null);
|
|
423
445
|
get onerror(): ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
|
|
@@ -438,27 +460,29 @@ declare class XMLHttpRequestEventTargetP extends EventTargetP implements XMLHttp
|
|
|
438
460
|
hierarchy: string[];
|
|
439
461
|
};
|
|
440
462
|
}
|
|
463
|
+
declare const _handlers$1: unique symbol;
|
|
441
464
|
declare class XMLHttpRequestEventTargetState {
|
|
442
465
|
/**
|
|
443
466
|
* @param _target XMLHttpRequestEventTargetP
|
|
444
467
|
*/
|
|
445
468
|
constructor(_target: unknown);
|
|
446
469
|
target: XMLHttpRequest;
|
|
447
|
-
|
|
470
|
+
[_handlers$1]: {
|
|
471
|
+
onabort: (ev: ProgressEvent) => void;
|
|
472
|
+
onerror: (ev: ProgressEvent) => void;
|
|
473
|
+
onload: (ev: ProgressEvent) => void;
|
|
474
|
+
onloadend: (ev: ProgressEvent) => void;
|
|
475
|
+
onloadstart: (ev: ProgressEvent) => void;
|
|
476
|
+
onprogress: (ev: ProgressEvent) => void;
|
|
477
|
+
ontimeout: (ev: ProgressEvent) => void;
|
|
478
|
+
};
|
|
448
479
|
onabort: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
|
|
449
|
-
_onabort: (ev: ProgressEvent) => void;
|
|
450
480
|
onerror: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
|
|
451
|
-
_onerror: (ev: ProgressEvent) => void;
|
|
452
481
|
onload: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
|
|
453
|
-
_onload: (ev: ProgressEvent) => void;
|
|
454
482
|
onloadend: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
|
|
455
|
-
_onloadend: (ev: ProgressEvent) => void;
|
|
456
483
|
onloadstart: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
|
|
457
|
-
_onloadstart: (ev: ProgressEvent) => void;
|
|
458
484
|
onprogress: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
|
|
459
|
-
_onprogress: (ev: ProgressEvent) => void;
|
|
460
485
|
ontimeout: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null;
|
|
461
|
-
_ontimeout: (ev: ProgressEvent) => void;
|
|
462
486
|
}
|
|
463
487
|
|
|
464
488
|
declare class XMLHttpRequestUploadP extends XMLHttpRequestEventTargetP implements XMLHttpRequestUpload {
|
|
@@ -470,83 +494,6 @@ declare class XMLHttpRequestUploadP extends XMLHttpRequestEventTargetP implement
|
|
|
470
494
|
};
|
|
471
495
|
}
|
|
472
496
|
|
|
473
|
-
interface IGeneralCallbackResult {
|
|
474
|
-
/**
|
|
475
|
-
* 网络请求过程中的一些异常信息,例如httpdns超时等
|
|
476
|
-
*/
|
|
477
|
-
exception: {
|
|
478
|
-
/**
|
|
479
|
-
* 本次请求底层重试次数
|
|
480
|
-
*/
|
|
481
|
-
retryCount: number;
|
|
482
|
-
/**
|
|
483
|
-
* 本次请求底层失败信息,所有失败信息均符合Errno错误码
|
|
484
|
-
*/
|
|
485
|
-
reasons: Array<{
|
|
486
|
-
/**
|
|
487
|
-
* 错误原因
|
|
488
|
-
*/
|
|
489
|
-
errMsg: string;
|
|
490
|
-
/**
|
|
491
|
-
* 错误码
|
|
492
|
-
*/
|
|
493
|
-
errno: number;
|
|
494
|
-
}>;
|
|
495
|
-
};
|
|
496
|
-
/**
|
|
497
|
-
* 最终请求是否使用了HttpDNS解析的IP。仅当enableHttpDNS传true时返回此字段。如果开启enableHttpDNS但最终请求未使用HttpDNS解析的IP,可在exception查看原因。
|
|
498
|
-
*/
|
|
499
|
-
useHttpDNS: boolean;
|
|
500
|
-
}
|
|
501
|
-
interface IRequestSuccessCallbackBaseResult {
|
|
502
|
-
/**
|
|
503
|
-
* 开发者服务器返回的数据
|
|
504
|
-
*/
|
|
505
|
-
data: string | object | ArrayBuffer;
|
|
506
|
-
/**
|
|
507
|
-
* 开发者服务器返回的 HTTP 状态码
|
|
508
|
-
*/
|
|
509
|
-
statusCode: number;
|
|
510
|
-
/**
|
|
511
|
-
* 开发者服务器返回的 HTTP Response Header
|
|
512
|
-
*/
|
|
513
|
-
header: object;
|
|
514
|
-
}
|
|
515
|
-
interface IRequestFailCallbackResult extends IGeneralCallbackResult {
|
|
516
|
-
/**
|
|
517
|
-
* 错误信息
|
|
518
|
-
*/
|
|
519
|
-
errMsg: string;
|
|
520
|
-
/**
|
|
521
|
-
* errno 错误码
|
|
522
|
-
*/
|
|
523
|
-
errno: number;
|
|
524
|
-
}
|
|
525
|
-
interface IAliRequestFailCallbackResult {
|
|
526
|
-
/**
|
|
527
|
-
* 错误码
|
|
528
|
-
*/
|
|
529
|
-
error: number;
|
|
530
|
-
/**
|
|
531
|
-
* 错误信息
|
|
532
|
-
*/
|
|
533
|
-
errorMessage: string;
|
|
534
|
-
/**
|
|
535
|
-
* 开发者服务器返回的数据,格式取决于请求时的 dataType 参数。
|
|
536
|
-
* 注意:当错误码为 14 或 19 时才会返回此字段
|
|
537
|
-
*/
|
|
538
|
-
data?: string | object | ArrayBuffer;
|
|
539
|
-
/**
|
|
540
|
-
* 开发者服务器返回的 HTTP 状态码
|
|
541
|
-
* 注意:当错误码为 14 或 19 时才会返回此字段
|
|
542
|
-
*/
|
|
543
|
-
status?: number;
|
|
544
|
-
/**
|
|
545
|
-
* 开发者服务器返回的 HTTP Response Header
|
|
546
|
-
* 注意:当错误码为 14 或 19 时才会返回此字段
|
|
547
|
-
*/
|
|
548
|
-
headers?: object;
|
|
549
|
-
}
|
|
550
497
|
interface IRequestTask {
|
|
551
498
|
/**
|
|
552
499
|
* 中断请求任务
|
|
@@ -588,7 +535,7 @@ interface IRequestTask {
|
|
|
588
535
|
offChunkReceived: (listener: Function) => void;
|
|
589
536
|
}
|
|
590
537
|
|
|
591
|
-
declare const state$
|
|
538
|
+
declare const state$4: unique symbol;
|
|
592
539
|
|
|
593
540
|
declare class XMLHttpRequestP extends XMLHttpRequestEventTargetP implements XMLHttpRequest {
|
|
594
541
|
static readonly UNSENT = 0;
|
|
@@ -597,7 +544,7 @@ declare class XMLHttpRequestP extends XMLHttpRequestEventTargetP implements XMLH
|
|
|
597
544
|
static readonly LOADING = 3;
|
|
598
545
|
static readonly DONE = 4;
|
|
599
546
|
constructor();
|
|
600
|
-
[state$
|
|
547
|
+
[state$4]: XMLHttpRequestState;
|
|
601
548
|
readonly UNSENT = 0;
|
|
602
549
|
readonly OPENED = 1;
|
|
603
550
|
readonly HEADERS_RECEIVED = 2;
|
|
@@ -614,7 +561,7 @@ declare class XMLHttpRequestP extends XMLHttpRequestEventTargetP implements XMLH
|
|
|
614
561
|
get statusText(): string;
|
|
615
562
|
get timeout(): number;
|
|
616
563
|
set timeout(value: number);
|
|
617
|
-
get upload():
|
|
564
|
+
get upload(): XMLHttpRequestUpload;
|
|
618
565
|
get withCredentials(): boolean;
|
|
619
566
|
set withCredentials(value: boolean);
|
|
620
567
|
abort(): void;
|
|
@@ -632,6 +579,16 @@ declare class XMLHttpRequestP extends XMLHttpRequestEventTargetP implements XMLH
|
|
|
632
579
|
hierarchy: string[];
|
|
633
580
|
};
|
|
634
581
|
}
|
|
582
|
+
declare const _handlers: unique symbol;
|
|
583
|
+
declare const _inAfterOpenBeforeSend: unique symbol;
|
|
584
|
+
declare const _resetPending: unique symbol;
|
|
585
|
+
declare const _timeoutId: unique symbol;
|
|
586
|
+
declare const _requestURL: unique symbol;
|
|
587
|
+
declare const _method: unique symbol;
|
|
588
|
+
declare const _requestHeaders: unique symbol;
|
|
589
|
+
declare const _responseHeaders: unique symbol;
|
|
590
|
+
declare const _responseContentLength: unique symbol;
|
|
591
|
+
declare const _requestTask: unique symbol;
|
|
635
592
|
declare class XMLHttpRequestState {
|
|
636
593
|
constructor(target: XMLHttpRequestP);
|
|
637
594
|
target: XMLHttpRequestP;
|
|
@@ -644,27 +601,19 @@ declare class XMLHttpRequestState {
|
|
|
644
601
|
timeout: number;
|
|
645
602
|
upload: XMLHttpRequestUploadP;
|
|
646
603
|
withCredentials: boolean;
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
_reqURL: string;
|
|
651
|
-
_method: string;
|
|
652
|
-
_reqHeaders: Record<string, string>;
|
|
653
|
-
_resHeaders: Record<string, string> | null;
|
|
654
|
-
_resContLen: number;
|
|
655
|
-
_requestTask: IRequestTask | null;
|
|
656
|
-
execRequest(body?: Document | XMLHttpRequestBodyInit | null): void;
|
|
657
|
-
requestSuccess({ statusCode, header, data }: IRequestSuccessCallbackBaseResult): void;
|
|
658
|
-
requestFail(err: IRequestFailCallbackResult | IAliRequestFailCallbackResult): void;
|
|
659
|
-
requestComplete(): void;
|
|
660
|
-
clearRequest(delay?: boolean): void;
|
|
661
|
-
checkRequestTimeout(): void;
|
|
662
|
-
resetXHR(): void;
|
|
663
|
-
resetRequestTimeout(): void;
|
|
664
|
-
emitProcessEvent(type: string, loaded?: number, total?: number, target?: XMLHttpRequestEventTargetP): void;
|
|
665
|
-
setReadyStateAndNotify(value: number): void;
|
|
604
|
+
[_handlers]: {
|
|
605
|
+
onreadystatechange: (ev: Event) => void;
|
|
606
|
+
};
|
|
666
607
|
onreadystatechange: ((this: XMLHttpRequest, ev: Event) => any) | null;
|
|
667
|
-
|
|
608
|
+
[_inAfterOpenBeforeSend]: boolean;
|
|
609
|
+
[_resetPending]: boolean;
|
|
610
|
+
[_timeoutId]: number;
|
|
611
|
+
[_requestURL]: string;
|
|
612
|
+
[_method]: string;
|
|
613
|
+
[_requestHeaders]: Record<string, string>;
|
|
614
|
+
[_responseHeaders]: Record<string, string> | null;
|
|
615
|
+
[_responseContentLength]: number | (() => number);
|
|
616
|
+
[_requestTask]: IRequestTask | null;
|
|
668
617
|
}
|
|
669
618
|
declare const XMLHttpRequestE: {
|
|
670
619
|
new (): XMLHttpRequest;
|
|
@@ -679,9 +628,10 @@ declare const XMLHttpRequestE: {
|
|
|
679
628
|
declare function fetchP(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
680
629
|
declare const fetchE: typeof fetch;
|
|
681
630
|
|
|
631
|
+
declare const state$3: unique symbol;
|
|
682
632
|
declare class HeadersP implements Headers {
|
|
683
633
|
constructor(init?: HeadersInit);
|
|
684
|
-
[state$
|
|
634
|
+
[state$3]: HeadersState;
|
|
685
635
|
append(name: string, value: string): void;
|
|
686
636
|
delete(name: string): void;
|
|
687
637
|
get(name: string): string | null;
|
|
@@ -699,19 +649,20 @@ declare class HeadersP implements Headers {
|
|
|
699
649
|
hierarchy: string[];
|
|
700
650
|
};
|
|
701
651
|
}
|
|
652
|
+
declare const _headersMap: unique symbol;
|
|
702
653
|
declare class HeadersState {
|
|
703
|
-
|
|
654
|
+
[_headersMap]: Map<string, [string, string]>;
|
|
704
655
|
}
|
|
705
656
|
declare const HeadersE: {
|
|
706
657
|
new (init?: HeadersInit): Headers;
|
|
707
658
|
prototype: Headers;
|
|
708
659
|
};
|
|
709
660
|
|
|
710
|
-
declare const state: unique symbol;
|
|
661
|
+
declare const state$2: unique symbol;
|
|
711
662
|
|
|
712
663
|
declare class BodyP implements Body {
|
|
713
664
|
constructor();
|
|
714
|
-
[state]: BodyState;
|
|
665
|
+
[state$2]: BodyState;
|
|
715
666
|
get body(): ReadableStream<TUint8ArrayOfArrayBuffer> | null;
|
|
716
667
|
get bodyUsed(): boolean;
|
|
717
668
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
@@ -726,23 +677,18 @@ declare class BodyP implements Body {
|
|
|
726
677
|
hierarchy: string[];
|
|
727
678
|
};
|
|
728
679
|
}
|
|
680
|
+
declare const _name: unique symbol;
|
|
681
|
+
declare const _body: unique symbol;
|
|
729
682
|
declare class BodyState {
|
|
730
683
|
bodyUsed: boolean;
|
|
731
|
-
_name: string;
|
|
732
|
-
_body: string | ArrayBuffer;
|
|
733
|
-
init(body?: ConstructorParameters<typeof Response>[0], headers?: Headers): void;
|
|
734
|
-
read(k: "arrayBuffer"): Promise<ArrayBuffer>;
|
|
735
|
-
read(k: "blob"): Promise<Blob>;
|
|
736
|
-
read(k: "bytes"): Promise<TUint8ArrayOfArrayBuffer>;
|
|
737
|
-
read(k: "formData"): Promise<FormData>;
|
|
738
|
-
read(k: "json"): Promise<any>;
|
|
739
|
-
read(k: "text"): Promise<string>;
|
|
740
|
-
consumed(kind: string): Promise<never> | undefined;
|
|
684
|
+
[_name]: string;
|
|
685
|
+
[_body]: string | ArrayBuffer;
|
|
741
686
|
}
|
|
742
687
|
|
|
688
|
+
declare const state$1: unique symbol;
|
|
743
689
|
declare class RequestP extends BodyP implements Request {
|
|
744
690
|
constructor(input: RequestInfo | URL, init?: RequestInit);
|
|
745
|
-
[state$
|
|
691
|
+
[state$1]: RequestState;
|
|
746
692
|
get cache(): RequestCache;
|
|
747
693
|
get credentials(): RequestCredentials;
|
|
748
694
|
get destination(): RequestDestination;
|
|
@@ -767,7 +713,7 @@ declare class RequestState {
|
|
|
767
713
|
cache: RequestCache;
|
|
768
714
|
credentials: RequestCredentials;
|
|
769
715
|
destination: RequestDestination;
|
|
770
|
-
headers
|
|
716
|
+
headers?: Headers;
|
|
771
717
|
integrity: string;
|
|
772
718
|
keepalive: boolean;
|
|
773
719
|
method: string;
|
|
@@ -775,7 +721,7 @@ declare class RequestState {
|
|
|
775
721
|
redirect: RequestRedirect;
|
|
776
722
|
referrer: string;
|
|
777
723
|
referrerPolicy: ReferrerPolicy;
|
|
778
|
-
signal
|
|
724
|
+
signal?: AbortSignal;
|
|
779
725
|
url: string;
|
|
780
726
|
}
|
|
781
727
|
declare const RequestE: {
|
|
@@ -783,9 +729,11 @@ declare const RequestE: {
|
|
|
783
729
|
prototype: Request;
|
|
784
730
|
};
|
|
785
731
|
|
|
732
|
+
declare const state: unique symbol;
|
|
733
|
+
|
|
786
734
|
declare class ResponseP extends BodyP implements Response {
|
|
787
735
|
constructor(body?: BodyInit | null, init?: ResponseInit);
|
|
788
|
-
[state
|
|
736
|
+
[state]: ResponseState;
|
|
789
737
|
get headers(): Headers;
|
|
790
738
|
get ok(): boolean;
|
|
791
739
|
get redirected(): boolean;
|
|
@@ -804,7 +752,7 @@ declare class ResponseP extends BodyP implements Response {
|
|
|
804
752
|
};
|
|
805
753
|
}
|
|
806
754
|
declare class ResponseState {
|
|
807
|
-
headers
|
|
755
|
+
headers?: Headers;
|
|
808
756
|
ok: boolean;
|
|
809
757
|
redirected: boolean;
|
|
810
758
|
status: number;
|