From b950ac6605baa612f0cfc56183e805184844e371 Mon Sep 17 00:00:00 2001 From: Anatoly Kudinov Date: Sat, 18 May 2013 00:37:14 +0400 Subject: Per request timeouts --- pollymer.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pollymer.js') 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++; -- cgit v1.2.3