[Pkg-javascript-commits] [sockjs-client] 106/434: It should be configurable whether XhrReceiver should use CORS-enabled ajax or not.
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:07 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository sockjs-client.
commit 4242c2715f120b6e34324ac3437773bca4eef918
Author: Marek Majkowski <majek04 at gmail.com>
Date: Thu Aug 25 17:12:58 2011 +0100
It should be configurable whether XhrReceiver should use CORS-enabled ajax or not.
---
lib/trans-polling.js | 5 +++--
lib/trans-receiver-xhr.js | 9 +++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/trans-polling.js b/lib/trans-polling.js
index a86adfc..a2a663e 100644
--- a/lib/trans-polling.js
+++ b/lib/trans-polling.js
@@ -1,15 +1,16 @@
-var Polling = function(ri, Receiver, recv_url) {
+var Polling = function(ri, Receiver, recv_url, opts) {
var that = this;
that.ri = ri;
that.Receiver = Receiver;
that.recv_url = recv_url;
+ that.opts = opts;
that._scheduleRecv();
};
Polling.prototype._scheduleRecv = function() {
var that = this;
- var poll = that.poll = new that.Receiver(that.recv_url);
+ var poll = that.poll = new that.Receiver(that.recv_url, that.opts);
var msg_counter = 0;
poll.onmessage = function(e) {
msg_counter += 1;
diff --git a/lib/trans-receiver-xhr.js b/lib/trans-receiver-xhr.js
index 6706375..fe97155 100644
--- a/lib/trans-receiver-xhr.js
+++ b/lib/trans-receiver-xhr.js
@@ -22,13 +22,14 @@ var XhrCorsReceiver = function(url) {
that.dispatchEvent(new SimpleEvent('close', {reason: reason}));
}
};
- var corsXhr = window.XDomainRequest ? utils.createXDR : utils.createXHR;
- that.xhr_close = corsXhr('POST', url, null, orsc);
+ var createXhr = (opts.cors && window.XDomainRequest) ?
+ utils.createXDR : utils.createXHR;
+ that.xhr_close = createXhr('POST', url, null, orsc);
};
-XhrCorsReceiver.prototype = new REventTarget();
+XhrReceiver.prototype = new REventTarget();
-XhrCorsReceiver.prototype.abort = function() {
+XhrReceiver.prototype.abort = function() {
var that = this;
if (that.xhr_close) {
that.xhr_close(true);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list