Skip to content

Commit

Permalink
feat(timeout): remove broken support for timeout
Browse files Browse the repository at this point in the history
close #5.
  • Loading branch information
stephanebachelier committed Apr 19, 2015
1 parent 1065f1e commit 808b820
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions lib/superapi/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ var serviceHandler = function(service) {
* - callback (function): callback to use, with a default which emits 'success' or 'error'
* event depending on res.ok value
* - edit (function): callback to use, to tweak req if needed.
* - timeout (number): milli seconds before a timeout error is thrown
*/
return function(options) {
options = options || {};
Expand All @@ -18,7 +17,6 @@ var serviceHandler = function(service) {
var query = options.query || {};
var callback = options.callback || null;
var edit = options.edit || null;
var timeout = options.timeout || 20000;

var self = this;
var req = this.request(service, data, params, query);
Expand Down Expand Up @@ -48,17 +46,6 @@ var serviceHandler = function(service) {
}
});

if (timeout) {
req.xhr.timeout = timeout;
req.xhr.ontimeout = function () {
req.aborted = true;
var response = new self.agent.Response(req);
response.timeout = true;
response.error = true;
req.emit('abort', response);
}
}

req.on('abort', function (res) {
resolver.reject(res);
});
Expand Down

0 comments on commit 808b820

Please sign in to comment.