LuCI. xhr

The LuCI.xhr class is a legacy compatibility shim for the functionality formerly provided by xhr.js. It is registered as a global window.XHR symbol for compatibility with legacy code.

New code should use LuCI.request instead to implement HTTP request handling.

Constructor

new xhr()

Deprecated
  • Yes

Methods

abort()

Ignored for backwards compatibility.

This function does nothing.

Deprecated
  • Yes

busy() → {boolean}

Checks the running state of the request.

Deprecated
  • Yes
Returns:

Returns true if the request is still running or false if it already completed.

Type: 
boolean

cancel()

Cancels a running request.

This function does not actually cancel the underlying XMLHTTPRequest request but it sets a flag which prevents the invocation of the callback function when the request eventually finishes or timed out.

Deprecated
  • Yes

get(url, dataopt, callbackopt, timeoutopt) → {Promise.<null>}

This function is a legacy wrapper around LuCI.get().

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request

dataObject<optional>

Additional query string data

callbackLuCI.requestCallbackFn<optional>

Callback function to invoke on completion

timeoutnumber<optional>

Request timeout to use

Deprecated
  • Yes
Returns:
Type: 
Promise.<null>

post(url, dataopt, callbackopt, timeoutopt) → {Promise.<null>}

This function is a legacy wrapper around LuCI.post().

Parameters:
NameTypeAttributesDescription
urlstring

The URL to request

dataObject<optional>

Additional data to append to the request body.

callbackLuCI.requestCallbackFn<optional>

Callback function to invoke on completion

timeoutnumber<optional>

Request timeout to use

Deprecated
  • Yes
Returns:
Type: 
Promise.<null>

send_form()

Existing for backwards compatibility.

This function simply throws an InternalError when invoked.

Deprecated
  • Yes
Throws:

Throws an InternalError with the message Not implemented when invoked.

Type
InternalError