Skip to content

Commit 026e146

Browse files
author
Hector Virgen
committed
Prepare for 0.1.19 release
1 parent a992a7a commit 026e146

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

api-angular-min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-angular.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@
4444
// Track is autogenerated per API instance, allowing the API server
4545
// to know which API calls are made within a single requst.
4646
track: this._generateTrackId()
47-
}
47+
},
48+
49+
// How long to wait before aborting long-running requests.
50+
timeout: 10000
4851
}, options || {});
4952

5053
// The user's cookies are required by the API to properly handle the request.
@@ -58,6 +61,10 @@
5861
}.bind(this));
5962
}
6063

64+
var timeout = parseInt(this._options.timeout, 10) || 10000;
65+
if (timeout < 0) timeout = 10000;
66+
this._http.setTimeout(timeout);
67+
6168
this._events = {};
6269
};
6370

@@ -341,8 +348,13 @@
341348
function AngularAdapter($http, $window) {
342349
this._$http = $http;
343350
this._$window = $window;
351+
this._timeout = 10000;
344352
}
345353

354+
AngularAdapter.prototype.setTimeout = function(timeout) {
355+
this._timeout = parseInt(timeout, 10) || 10000;
356+
};
357+
346358
AngularAdapter.prototype.post = function(req) {
347359
var headers = {
348360
'x-tagged-client-id': req.clientId,
@@ -351,7 +363,7 @@
351363
'X-Requested-With': 'XMLHttpRequest'
352364
};
353365
return this._$http.post(req.url, req.body, {
354-
timeout: 10000,
366+
timeout: this._timeout,
355367
transformResponse: transformResponse,
356368
headers: headers
357369
}).then(formatResponse);
@@ -399,14 +411,17 @@
399411

400412
taggedApiFactory.$inject = ['$http', '$q', '$window'];
401413
function taggedApiFactory($http, $q, $window) {
414+
this.timeout = 10000;
415+
402416
var angularAdapter = new TaggedApi.AngularAdapter($http, $window);
403417

404418
var api = new TaggedApi('/api/', {
405419
query: {
406420
application_id: 'user',
407421
format: 'json'
408422
},
409-
clientId: this.clientId
423+
clientId: this.clientId,
424+
timeout: this.timeout
410425
}, angularAdapter);
411426

412427
// Wrap `execute()` in an Angular promise

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tagged-api-client",
3-
"version": "0.1.18",
3+
"version": "0.1.19",
44
"authors": [
55
"Hector Virgen <[email protected]>"
66
],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tagged-api",
3-
"version": "0.1.18",
3+
"version": "0.1.19",
44
"description": "API client for Tagged with support for nodejs and angularjs",
55
"main": "lib/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)