Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core-xhr.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
* @param {String} inOptions.responseType The response type. Default is 'text'.
* @param {boolean} inOptions.withCredentials Whether or not to send credentials on the request. Default is false.
* @param {Object} inOptions.callback Called when request is completed.
* @param {Number} inOptions.timeout Time, in miliseconds, a request can take before being terminated. Defaults to 0, which means no timeout.
* @param {Function} inOptions.ontimeout A function to run when the timeout is reached.
* @returns {Object} XHR object.
*/
request: function(options) {
Expand All @@ -60,6 +62,10 @@
if (options.responseType) {
xhr.responseType = options.responseType;
}
if (options.timeout) {
xhr.timeout = options.timeout;
xhr.ontimeout = options.ontimeout || function(){};
}
if (options.withCredentials) {
xhr.withCredentials = true;
}
Expand Down