Interface VMScriptGMXHRDetails<T>

interface VMScriptGMXHRDetails<T> {
    anonymous?: boolean;
    binary?: boolean;
    context?: unknown;
    data?:
        | string
        | ArrayBuffer
        | DataView
        | Blob
        | FormData
        | URLSearchParams
        | ReadableStream
        | TypedArray;
    headers?: Record<string, string>;
    method?: string;
    onabort?: (resp: VMScriptResponseObject<T>) => void;
    onerror?: (resp: VMScriptResponseObject<T>) => void;
    onload?: (resp: VMScriptResponseObject<T>) => void;
    onloadend?: (resp: VMScriptResponseObject<T>) => void;
    onloadstart?: (resp: VMScriptResponseObject<T>) => void;
    onprogress?: (resp: VMScriptResponseObject<T>) => void;
    onreadystatechange?: (resp: VMScriptResponseObject<T>) => void;
    ontimeout?: (resp: VMScriptResponseObject<T>) => void;
    overrideMimeType?: string;
    password?: string;
    responseType?: VMScriptResponseType;
    timeout?: number;
    url: string;
    user?: string;
}

Type Parameters

  • T

Hierarchy (View Summary)

Properties

anonymous?: boolean

When set to true, no cookie will be sent with the request and the response cookies will be ignored. The default value is false.

binary?: boolean

Send the data string as a blob. This is for compatibility with Tampermonkey/Greasemonkey, where only string type is allowed in data.

context?: unknown

Can be an object and will be assigned to context of the response object.

data?:
    | string
    | ArrayBuffer
    | DataView
    | Blob
    | FormData
    | URLSearchParams
    | ReadableStream
    | TypedArray

Data to send with the request, usually for POST and PUT requests.

headers?: Record<string, string>

Some special headers are also allowed:

  • Cookie
  • Host
  • Origin
  • Referer
  • User-Agent
method?: string

HTTP method, default as GET.

onabort?: (resp: VMScriptResponseObject<T>) => void
onerror?: (resp: VMScriptResponseObject<T>) => void
onload?: (resp: VMScriptResponseObject<T>) => void
onloadend?: (resp: VMScriptResponseObject<T>) => void
onloadstart?: (resp: VMScriptResponseObject<T>) => void
onprogress?: (resp: VMScriptResponseObject<T>) => void
onreadystatechange?: (resp: VMScriptResponseObject<T>) => void
ontimeout?: (resp: VMScriptResponseObject<T>) => void
overrideMimeType?: string

A MIME type to specify with the request.

password?: string

Password for authentication.

responseType?: VMScriptResponseType

One of the following:

  • text (default value)
  • json
  • blob
  • arraybuffer
  • document
timeout?: number

Time to wait for the request, none by default.

url: string

URL relative to current page is also allowed.

user?: string

User for authentication.