Class XHRUtils

XHR utils contains public static methods to allow easy access to services via XHR.

Constructors

Methods

Constructors

Methods

  • Get file data from URL as text, using a XHR call.

    Parameters

    • url: string

      Target for the request.

    Returns Promise<any>

  • Get raw file data from URL, using a XHR call.

    Parameters

    • url: string

      Target for the request.

    Returns Promise<ArrayBuffer>

  • Perform a request with the specified configuration.

    Syncronous request should be avoided unless they are strictly necessary.

    Parameters

    • url: string

      Target for the request.

    • type: string

      Resquest type (POST, GET, ...)

    • Optional header: any

      Object with data to be added to the request header.

    • Optional body: any

      Data to be sent in the resquest.

    • Optional onLoad: Function

      On load callback, receives data (String or Object) and XHR as arguments.

    • Optional onError: Function

      XHR onError callback.

    • Optional onProgress: Function

    Returns XMLHttpRequest