RequestModule

RequestModule

new RequestModule()

Source:

Members

(static) READY_STATE_DONE :number

Source:
Default Value:
  • 4

Downloading is done

Type:
  • number

(static) READY_STATE_HEADERS_RECEIVED :number

Source:
Default Value:
  • 2

send() has been called, and headers and status are available.

Type:
  • number

(static) READY_STATE_LOADING :number

Source:
Default Value:
  • 3

Downloading; responseText holds partial data.

Type:
  • number

(static) READY_STATE_OPENED :number

Source:
Default Value:
  • 1

open() has been called.

Type:
  • number

(static) READY_STATE_UNSENT :number

Source:
Default Value:
  • 0

Client has been created. open() not called yet.

Type:
  • number

Methods

(static) ParamsParser(value, pattern, optsopt) → {Object.<string, string>}

Source:
Parameters:
Name Type Attributes Description
value string
pattern string
opts object <optional>
Properties
Name Type Attributes Default Description
cache object <optional>

object where reg expressions will be cached

mapper function <optional>

function that will decode value, default is decodeURIComponent

boud string <optional>
"\x02\x00\x00\x03"

function that will decode value, default is decodeURIComponent

ret object <optional>

object to be updated with found params

tableIndex Array.<string> <optional>

list of parameters' names ( @experimental )

pRegExp string <optional>
"\\:([a-z][a-z0-9]+)"

RegExp params' chars

matchGroup string <optional>
"([^\\/]+)"

RegExp value

fixedEnd string <optional>
true

RegExp value

Returns:
Type
Object.<string, string>

async() → {boolean}

Source:
See:
  • RequestModule.RequestConfig

returns RequestModule.RequestConfig["async"]

Returns:
Type
boolean

async(status) → {RequestModule}

Source:
Parameters:
Name Type Description
status boolean

enable/disable XMLHttpRequest async mode

Returns:
Type
RequestModule

basicAuth() → {Object}

Source:
See:
  • RequestModule.RequestConfig
Returns:
Type
Object

basicAuth(username, password) → {RequestModule}

Source:
Parameters:
Name Type Description
username string | null
password string | null
Returns:
Type
RequestModule

config() → {RequestModule.RequestConfig}

Source:
Returns:
Type
RequestModule.RequestConfig

configurator(template) → {RequestModule}

Source:
Parameters:
Name Type Description
template 'multipart' | 'blob' | 'binary' | 'POST' | 'prepare-multipart' | 'retrieve-blob' | 'retrieve-binary-string' | 'prepare-post' | 'check-status-code' | 'ignore-status-code'

configuration name

Returns:
Type
RequestModule

headers() → {string}

Source:
Returns:
Type
string

headers(name, value) → {RequestModule}

Source:

set a new header

Parameters:
Name Type Description
name string
value string
Returns:
Type
RequestModule

method() → {string}

Source:
See:
  • RequestModule.RequestConfig

returns RequestModule.RequestConfig["method"]

Returns:
Type
string

method(status) → {RequestModule}

Source:
Parameters:
Name Type Description
status string

XMLHttpRequest method name, default is "GET"

Returns:
Type
RequestModule

open(methodopt, urlopt, asyncopt, timeoutopt) → {RequestModule}

Source:
Parameters:
Name Type Attributes Default Description
method string <optional>
"GET"
url string <optional>
async boolean <optional>
timeout number <optional>

request timeout in seconds

Returns:
Type
RequestModule

readyState() → {RequestModule.readyStateType}

Source:
Returns:
Type
RequestModule.readyStateType

request() → {XMLHttpRequest}

Source:
Returns:
Type
XMLHttpRequest

response(typeopt, optionsopt) → {RequestModule|Promise.<ArrayBuffer>|Promise.<Blob>|Promise.<HTMLElement>|Promise.<DocumentFragment>|Promise.<string>|ArrayBuffer|Blob|HTMLElement|string}

Source:
Parameters:
Name Type Attributes Description
type '' | 'request' | 'blob' | 'arraybuffer' | 'text' | 'json' | 'document' <optional>
options object <optional>
Properties
Name Type Attributes Default Description
type string <optional>
"application/octet-stream"

Blob constructor's params

Returns:
Type
RequestModule | Promise.<ArrayBuffer> | Promise.<Blob> | Promise.<HTMLElement> | Promise.<DocumentFragment> | Promise.<string> | ArrayBuffer | Blob | HTMLElement | string

send(dataopt, typeopt, headersopt) → {RequestModule}

Source:
Parameters:
Name Type Attributes Default Description
data string | FormData | MediaStream <optional>
''
type "asFormData" | "json" | "urlencoded" <optional>
null
headers Object.<string, string> <optional>
Returns:
Type
RequestModule

status() → {number}

Source:
Returns:
Type
number

statusText() → {string}

Source:
Returns:
Type
string

timeout() → {number}

Source:

current XMLHttpRequest timeout in seconds

Returns:
Type
number

timeout(seconds) → {RequestModule}

Source:

update XMLHttpRequest timeout in seconds

Parameters:
Name Type Description
seconds number

set 0 to unlimited

Returns:
Type
RequestModule

url() → {string}

Source:
See:
  • RequestModule.RequestConfig

returns RequestModule.RequestConfig["url"]

Returns:
Type
string

url(url) → {RequestModule}

Source:
Parameters:
Name Type Description
url string

setup the url that should be processed

Returns:
Type
RequestModule

withCredentials() → {boolean}

Source:

current XMLHttpRequest withCredentials status

Returns:
Type
boolean

withCredentials(status) → {RequestModule}

Source:

update XMLHttpRequest withCredentials flag

Parameters:
Name Type Description
status boolean
Returns:
Type
RequestModule

Type Definitions

readyStateType

Source:
Properties:
Name Type Attributes Default Description
READY_STATE_UNSENT number <optional>
0
READY_STATE_OPENED number <optional>
1
READY_STATE_HEADERS_RECEIVED number <optional>
2
READY_STATE_LOADING number <optional>
3
READY_STATE_DONE number <optional>
4
Type:
  • object

RequestConfig

Source:
Properties:
Name Type Attributes Default Description
method boolean <optional>
"GET"
url boolean <optional>
"#"
async boolean <optional>
true
opened boolean <optional>
false
isSent boolean <optional>
false
isLoaded boolean <optional>
false
isUploaded boolean <optional>
false
ignoreStatusCode boolean <optional>
false
ignoreStatusCode boolean <optional>
false
basicAuthUsername string | null <optional>
basicAuthPassword string | null <optional>
headers Object.<string, string> <optional>
Type:
  • Object