diff options
author | Justin Karneges <justin@affinix.com> | 2013-04-12 02:50:21 -0700 |
---|---|---|
committer | Justin Karneges <justin@affinix.com> | 2013-04-12 02:50:21 -0700 |
commit | 74e587b1b6d6349f50c082ed7afece8d43be546d (patch) | |
tree | a3700724878171eb70a60aa9e9c2b8e0841c294d | |
parent | 223e956f8b1482349bf2c01f67b43f67e3027d5b (diff) | |
download | pollymer-74e587b1b6d6349f50c082ed7afece8d43be546d.tar pollymer-74e587b1b6d6349f50c082ed7afece8d43be546d.tar.gz |
rename to pollymer
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | README | 24 | ||||
-rw-r--r-- | pollymer.js (renamed from polldance.js) | 28 |
3 files changed, 33 insertions, 33 deletions
@@ -3,15 +3,15 @@ VERSION = 1.0.0 all: dist distclean: - rm -f polldance-$(VERSION).js polldance-$(VERSION).min.js + rm -f pollymer-$(VERSION).js pollymer-$(VERSION).min.js clean: -dist: polldance-$(VERSION).min.js +dist: pollymer-$(VERSION).min.js -polldance-$(VERSION).js: polldance.js - cp polldance.js polldance-$(VERSION).js +pollymer-$(VERSION).js: pollymer.js + cp pollymer.js pollymer-$(VERSION).js -polldance-$(VERSION).min.js: polldance-$(VERSION).js - sed -e "s/DEBUG = true/DEBUG = false/g" polldance-$(VERSION).js | ./compile.py > polldance-$(VERSION).min.js.tmp - mv polldance-$(VERSION).min.js.tmp polldance-$(VERSION).min.js +pollymer-$(VERSION).min.js: pollymer-$(VERSION).js + sed -e "s/DEBUG = true/DEBUG = false/g" pollymer-$(VERSION).js | ./compile.py > pollymer-$(VERSION).min.js.tmp + mv pollymer-$(VERSION).min.js.tmp pollymer-$(VERSION).min.js @@ -1,11 +1,11 @@ -PollDance ---------- -Date: January 31st, 2013 +Pollymer +-------- +Date: April 12th, 2013 Authors: Justin Karneges <justin@fanout.io> Katsuyuki Ohmuro <harmony7@pex2.jp> Mailing List: http://lists.fanout.io/listinfo.cgi/fanout-users-fanout.io -PollDance is a general-purpose AJAX library that provides conveniences for +Pollymer is a general-purpose AJAX library that provides conveniences for long-polling applications, such as request retries, exponential backoff between requests, randomized request delaying, and workarounds for browser "busy" indications. It also implements multiple transports to ensure @@ -32,7 +32,7 @@ Limitations: Usage: - var req = new PollDance.Request(); + var req = new Pollymer.Request(); req.on('finished', function(code, result, headers) { ... }); req.on('error', function(reason) { ... }); var headers = { ... }; @@ -52,7 +52,7 @@ Methods of Request Object: result: JSON object or string headers: hash of key/value strings 'error': function(reason) - reason: PollDance.errorType + reason: Pollymer.errorType off(event_name) - Remove callback for event @@ -70,7 +70,7 @@ Methods of Request Object: (unless the recurring flag is set, see below). If called again on the same object, a short random delay will be added before performing the request. - retry() - Attempt the exact same request again. Normally, PollDance will + retry() - Attempt the exact same request again. Normally, Pollymer will automatically retry a request that it considers to be a failure, but this method may be used if the application needs to retry the request for any another reason. Retries have an exponentially increasing delay between @@ -85,7 +85,7 @@ Properties of Request Object: Properties are simple members of the object. They can be set directly: req.rawResponse = true; or passed in a hash during construction: - var req = new PollDance.Request({rawResponse: true}); + var req = new Pollymer.Request({rawResponse: true}); rawResponse: boolean By default, this library will parse response body data as JSON and return @@ -104,11 +104,11 @@ Properties of Request Object: recurring: boolean If set to true, then after a request finishes with a code between 200 and 299, and the finished event has been raised, the same request will be - started again. This allows PollDance to automatically poll a resource + started again. This allows Pollymer to automatically poll a resource endlessly. Pass a function as the url argument in order to be able to change the url between polls. - transport: PollDance.transportType + transport: Pollymer.transportType Explicitly set the transport to use. Default is transportType.Auto, which automatically chooses the best transport when the request is started. @@ -116,11 +116,11 @@ Retries: When a request fails at the transport level, or the request succeeds with an error code between 500 and 599, and maxTries has not been reached, then - PollDance will retry the request silently, with an exponentially increasing + Pollymer will retry the request silently, with an exponentially increasing delay between attempts. In any other case, the request will succeed and the finished event will be raised. If the application determines that the response indicates a temporary error and should be retried with the same - backoff delay that PollDance normally uses, the retry() method may be used. + backoff delay that Pollymer normally uses, the retry() method may be used. Request Reuse: diff --git a/polldance.js b/pollymer.js index 94817f4..d4cd078 100644 --- a/polldance.js +++ b/pollymer.js @@ -1,5 +1,5 @@ /** - * PollDance JavaScript Library v1.0.0 + * Pollymer JavaScript Library v1.0.0 * Copyright 2013 Fan Out Networks, Inc. * Released under the MIT license (see COPYING file in source distribution) */ @@ -8,7 +8,7 @@ var DEBUG = true; (function (window, undefined) { - var NAMESPACE = "PollDance"; + var NAMESPACE = "Pollymer"; var TIMEOUT = 60000; var emptyMethod = function () { }; @@ -177,7 +177,7 @@ var DEBUG = true; "Jsonp": 2 }; - // PollDance.Request has callback members: + // Pollymer.Request has callback members: // on('finished', int code, object result, object headers) // on('error', int reason) @@ -227,7 +227,7 @@ var DEBUG = true; }; Request.prototype.start = function (method, url, headers, body) { if (this._timer != null) { - consoleError("PD: start() called on a Request object that is currently running."); + consoleError("pollymer: start() called on a Request object that is currently running."); return; } @@ -244,7 +244,7 @@ var DEBUG = true; if (this._delayNext) { this._delayNext = false; delayTime = Math.floor(Math.random() * this.maxDelay); - consoleInfo("PD: polling again in " + delayTime + "ms"); + consoleInfo("pollymer: polling again in " + delayTime + "ms"); } else { delayTime = 0; // always queue the call, to prevent browser "busy" } @@ -253,11 +253,11 @@ var DEBUG = true; }; Request.prototype.retry = function () { if (this._tries == 0) { - consoleError("PD: retry() called on a Request object that has never been started."); + consoleError("pollymer: retry() called on a Request object that has never been started."); return; } if (this._timer != null) { - consoleError("PD: retry() called on a Request object that is currently running."); + consoleError("pollymer: retry() called on a Request object that is currently running."); return; } this._retry(); @@ -271,7 +271,7 @@ var DEBUG = true; var delayTime = this._retryTime * 1000; delayTime += Math.floor(Math.random() * this.maxDelay); - consoleInfo("PD: trying again in " + delayTime + "ms"); + consoleInfo("pollymer: trying again in " + delayTime + "ms"); this._initiate(delayTime); }; @@ -306,11 +306,11 @@ var DEBUG = true; this._timer = null; if (this._transport == transportTypes.Xhr) { - consoleInfo("PD: XHR cleanup"); + consoleInfo("pollymer: XHR cleanup"); this._cleanupXhr(this._xhr, abort); this._xhr = null; } else { // Jsonp - consoleInfo("PD: json-p " + this._jsonp.id + " cleanup"); + consoleInfo("pollymer: json-p " + this._jsonp.id + " cleanup"); this._cleanupJsonp(this._jsonp, abort); this._jsonp = null; } @@ -340,7 +340,7 @@ var DEBUG = true; xhr.send(body); - consoleInfo("PD: XHR start " + url); + consoleInfo("pollymer: XHR start " + url); return xhr; }; @@ -355,7 +355,7 @@ var DEBUG = true; Request.prototype._xhrCallback = function () { var xhr = this._xhr; if (xhr != null && xhr.readyState === 4) { - consoleInfo("PD: XHR finished"); + consoleInfo("pollymer: XHR finished"); var code = xhr.status; var reason = xhr.statusText; @@ -388,7 +388,7 @@ var DEBUG = true; jsonCallbacks.addJsonpCallback(jsonp.id, this); addJsonpScriptToDom(src, jsonp.scriptId); - consoleInfo("PD: json-p start " + jsonp.id + " " + src); + consoleInfo("pollymer: json-p start " + jsonp.id + " " + src); return jsonp; }; @@ -399,7 +399,7 @@ var DEBUG = true; } }; Request.prototype._jsonpCallback = function (result) { - consoleInfo("PD: json-p " + this._jsonp.id + " finished"); + consoleInfo("pollymer: json-p " + this._jsonp.id + " finished"); var code = ("code" in result) ? result.code : 0; var reason = ("reason" in result) ? result.reason : null; |