diff --git a/core-xhr.html b/core-xhr.html index dbc531b..92e1eaf 100644 --- a/core-xhr.html +++ b/core-xhr.html @@ -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) { @@ -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; }