Namespace orion.xhr
Provides a promise-based API to XMLHttpRequest.
Defined in: </shared/eclipse/e4/orion/I201404012230/bundles/org.eclipse.orion.client.core/web/orion/xhr.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
orion.xhr.xhr(method, url, options)
Wrapper for XMLHttpRequest that returns a promise.
|
Method Detail
<static>
{Deferred}
orion.xhr.xhr(method, url, options)
Wrapper for XMLHttpRequest that returns a promise.
- Parameters:
- {String} method
- One of 'GET', 'POST', 'PUT', 'DELETE'.
- {String} url
- The URL to request.
- {Object} options Optional
- {Object|ArrayBuffer|Blob|Document} options.data Optional
- The raw data to send as the request body. (Only allowed for POST and PUT).
- {Object} options.headers Optional
- A map of header names and values to set on the request.
- {Boolean} options.log Optional, Default: false
- If
true
, failed requests will be logged to the JavaScript console. - {String} options.responseType Optional, Default: ''
- Determines the type of the response object returned. Value must be one of the following:
'arraybuffer'
'blob'
'document'
'json'
'text'
''
(same as'text'
)
- {Number} options.timeout Optional, Default: 0
- Timeout in milliseconds. Defaults to 0 (no timeout).
- Returns:
- {Deferred} A deferred for the result. The deferred will resolve on 2xx, 3xx status codes or reject on 4xx, 5xx status codes. In both cases a orion.xhr.Result is provided to the listener.