type AJAXMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | string; type AJAXReqestType = "NONE" | "JSON" | "XML" | "FORM" | "FORMDATA" | "TEXT" | "BLOB"; type ResponseType = "none" | "json" | "blob" | "text" | "html"; type ResponseDelegate = (response: AjaxResponse) => void; type ErrorDelegate = (request: AjaxRequest, reason?: any) => void; type QueryData = { [key: string]: string | string[]; }; interface AjaxRequest { url?: string | null; query?: QueryData | null; method?: AJAXMethod | null; mode?: RequestMode; credentials?: RequestCredentials; timeout?: number | null; headers?: { [key: string]: string; } | null; type?: AJAXReqestType | null; data?: string | object | Blob | FormData | HTMLFormElement | null; abort?: AbortSignal; success?: ResponseDelegate | null; error?: ErrorDelegate | null; disableCache?: boolean | null; state?: TState | null; } interface AjaxResponse { status: number; redirected: boolean; url: string | null; type: ResponseType; contentType: string | null; headers: ResponseHeaders; data: TData | null; state?: TState | null; } interface ResponseHeaders { get(name: string): string | null; has(name: string): boolean; forEach(callbackfn: (value: string, key: string, parent: ResponseHeaders) => void, thisArg?: any): void; } /** Request with fetch. */ declare function request(options: AjaxRequest, abortSignal?: AbortSignal): Promise>; /** Request with XMLHttpRequest. */ declare const ajaxRequest: (options: AjaxRequest) => XMLHttpRequest; declare class AjaxQueue { private _options; private _requests; private _curent; private _destroyed; constructor(options?: AjaxQueueOptions); get length(): number; get isFree(): boolean; get isEmpty(): boolean; push(request: AjaxRequest, abortSignal?: AbortSignal): void; enque(request: AjaxRequest, abortSignal?: AbortSignal): Promise>; reset(cancelCurrentRequest?: boolean): void; destroy(): void; private __execute; private __next; } interface AjaxQueueOptions { canRequest?: (request: AjaxRequest) => void | boolean; successRequest?: (request: AjaxRequest, response: AjaxResponse) => void; errorRequest?: (response: AjaxRequest, reason?: any) => void; } declare const createQuery: (query?: QueryData | FormData | null) => URLSearchParams; declare const addQuery: (url: string, query?: QueryData | FormData | null) => string; declare const encodeForm: (data: FormData) => string; declare const helpers_addQuery: typeof addQuery; declare const helpers_createQuery: typeof createQuery; declare const helpers_encodeForm: typeof encodeForm; declare namespace helpers { export { helpers_addQuery as addQuery, helpers_createQuery as createQuery, helpers_encodeForm as encodeForm, }; } export { AjaxQueue, helpers as RequestHelper, ajaxRequest, request }; export type { AJAXMethod, AJAXReqestType, AjaxQueueOptions, AjaxRequest, AjaxResponse, ErrorDelegate, QueryData, ResponseDelegate, ResponseHeaders, ResponseType };