aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Karneges <justin@affinix.com>2013-05-17 15:54:11 -0700
committerJustin Karneges <justin@affinix.com>2013-05-17 15:54:11 -0700
commit646365204f663239346de479874dc4c862d27c41 (patch)
treef6a1c5ab1621dcee8daf3d76c9122c790b4455d1
parent354b15cef04c3929a2c239197f127d1976a9a53e (diff)
parentb950ac6605baa612f0cfc56183e805184844e371 (diff)
downloadpollymer-646365204f663239346de479874dc4c862d27c41.tar
pollymer-646365204f663239346de479874dc4c862d27c41.tar.gz
Merge pull request #2 from zerko/master
Per request timeouts
-rw-r--r--README4
-rw-r--r--pollymer.js7
2 files changed, 9 insertions, 2 deletions
diff --git a/README b/README
index a330340..eeff1e1 100644
--- a/README
+++ b/README
@@ -119,6 +119,10 @@ Properties of Request Object:
CORS request needs to have HTTP Cookies and/or HTTP Authentication
information sent along with it.
+ timeout: integer
+ Request wait timeout in milliseconds.
+ Default 60000.
+
Retries:
When a request fails at the transport level, or the request succeeds with an
diff --git a/pollymer.js b/pollymer.js
index 72b4b46..ddeda70 100644
--- a/pollymer.js
+++ b/pollymer.js
@@ -9,7 +9,6 @@ var DEBUG = true;
(function (window, undefined) {
var NAMESPACE = "Pollymer";
- var TIMEOUT = 60000;
var emptyMethod = function () { };
var consoleInfo;
@@ -206,6 +205,7 @@ var DEBUG = true;
this.maxDelay = 1000;
this.recurring = false;
this.withCredentials = false;
+ this.timeout = 60000
if (arguments.length > 0) {
var config = arguments[0];
@@ -227,6 +227,9 @@ var DEBUG = true;
if ("withCredentials" in config) {
this.withCredentials = config.withCredentials;
}
+ if ("timeout" in config) {
+ this.timeout = config.timeout
+ }
}
};
Request.prototype.start = function (method, url, headers, body) {
@@ -285,7 +288,7 @@ var DEBUG = true;
};
Request.prototype._startConnect = function () {
var self = this;
- this._timer = window.setTimeout(function () { self._timeout(); }, TIMEOUT);
+ this._timer = window.setTimeout(function () { self._timeout(); }, this.timeout);
this._tries++;