Skip to content

Commit

Permalink
Prepare for 0.1.19 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Hector Virgen committed Aug 10, 2015
1 parent a992a7a commit 026e146
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api-angular-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions api-angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@
// Track is autogenerated per API instance, allowing the API server
// to know which API calls are made within a single requst.
track: this._generateTrackId()
}
},

// How long to wait before aborting long-running requests.
timeout: 10000
}, options || {});

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

var timeout = parseInt(this._options.timeout, 10) || 10000;
if (timeout < 0) timeout = 10000;
this._http.setTimeout(timeout);

this._events = {};
};

Expand Down Expand Up @@ -341,8 +348,13 @@
function AngularAdapter($http, $window) {
this._$http = $http;
this._$window = $window;
this._timeout = 10000;
}

AngularAdapter.prototype.setTimeout = function(timeout) {
this._timeout = parseInt(timeout, 10) || 10000;
};

AngularAdapter.prototype.post = function(req) {
var headers = {
'x-tagged-client-id': req.clientId,
Expand All @@ -351,7 +363,7 @@
'X-Requested-With': 'XMLHttpRequest'
};
return this._$http.post(req.url, req.body, {
timeout: 10000,
timeout: this._timeout,
transformResponse: transformResponse,
headers: headers
}).then(formatResponse);
Expand Down Expand Up @@ -399,14 +411,17 @@

taggedApiFactory.$inject = ['$http', '$q', '$window'];
function taggedApiFactory($http, $q, $window) {
this.timeout = 10000;

var angularAdapter = new TaggedApi.AngularAdapter($http, $window);

var api = new TaggedApi('/api/', {
query: {
application_id: 'user',
format: 'json'
},
clientId: this.clientId
clientId: this.clientId,
timeout: this.timeout
}, angularAdapter);

// Wrap `execute()` in an Angular promise
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tagged-api-client",
"version": "0.1.18",
"version": "0.1.19",
"authors": [
"Hector Virgen <[email protected]>"
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tagged-api",
"version": "0.1.18",
"version": "0.1.19",
"description": "API client for Tagged with support for nodejs and angularjs",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 026e146

Please sign in to comment.