@wevu/web-apis
Version:
Web API polyfills and global installers for mini-program runtimes
70 lines (69 loc) • 2.02 kB
text/typescript
import { RequestGlobalsEventTarget } from "./shared.mjs";
import { RequestGlobalsMiniProgramOptions } from "./networkDefaults.mjs";
//#region src/xhr.d.ts
type XhrBody = Document | XMLHttpRequestBodyInit | null | undefined;
declare class XMLHttpRequestUploadPolyfill extends RequestGlobalsEventTarget {}
declare class XMLHttpRequestPolyfill extends RequestGlobalsEventTarget {
static readonly UNSENT = 0;
static readonly OPENED = 1;
static readonly HEADERS_RECEIVED = 2;
static readonly LOADING = 3;
static readonly DONE = 4;
readonly UNSENT = 0;
readonly OPENED = 1;
readonly HEADERS_RECEIVED = 2;
readonly LOADING = 3;
readonly DONE = 4;
readonly upload: XMLHttpRequestUploadPolyfill;
readyState: number;
response: any;
responseText: string;
responseType: XMLHttpRequestResponseType;
responseURL: string;
status: number;
statusText: string;
timeout: number;
withCredentials: boolean;
miniProgram: RequestGlobalsMiniProgramOptions | null;
onreadystatechange: ((event: {
type: string;
}) => void) | null;
onabort: ((event: {
type: string;
}) => void) | null;
onerror: ((event: {
type: string;
}) => void) | null;
onload: ((event: {
type: string;
}) => void) | null;
onloadend: ((event: {
type: string;
}) => void) | null;
onloadstart: ((event: {
type: string;
}) => void) | null;
onprogress: ((event: {
type: string;
}) => void) | null;
ontimeout: ((event: {
type: string;
}) => void) | null;
private method;
private url;
private readonly requestHeaders;
private responseHeaders;
private requestController;
private timeoutId;
private sent;
open(method: string, url: string): void;
setRequestHeader(key: string, value: string): void;
getAllResponseHeaders(): string;
getResponseHeader(key: string): string | null;
abort(): void;
send(body?: XhrBody): Promise<void>;
private finish;
private transitionTo;
}
//#endregion
export { XMLHttpRequestPolyfill, XMLHttpRequestUploadPolyfill };