[Pkg-javascript-commits] [sockjs-client] 303/434: In sender use passed XHR/XDR object, don't try go guess again.

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:21 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 cce687a002077a078246c687ef709948ab2050d0
Author: Marek Majkowski <majek04 at gmail.com>
Date:   Fri Jan 13 15:58:17 2012 +0000

    In sender use passed XHR/XDR object, don't try go guess again.
---
 lib/trans-sender.js        | 23 +++++++++--------------
 lib/trans-xhr-streaming.js |  2 +-
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/lib/trans-sender.js b/lib/trans-sender.js
index fc11694..76d56f9 100644
--- a/lib/trans-sender.js
+++ b/lib/trans-sender.js
@@ -114,19 +114,14 @@ var jsonPGenericSender = function(url, payload, callback) {
     return completed;
 };
 
-var _sender = function(cors, url, payload, callback) {
-    var xo = utils.createXHR(cors, 'POST', url + '/xhr_send', payload);
-    xo.onfinish = function(status, text) {
-        callback(status);
+var createAjaxSender = function(AjaxObject) {
+    return function(url, payload, callback) {
+        var xo = new AjaxObject('POST', url + '/xhr_send', payload);
+        xo.onfinish = function(status, text) {
+            callback(status);
+        };
+        return function(abort_reason) {
+            callback(0, abort_reason);
+        };
     };
-    return function(abort_reason) {
-        callback(0, abort_reason);
-    };
-};
-
-var ajaxSender = function(url, payload, callback) {
-    return _sender(false, url, payload, callback);
-};
-var xdrSender = function(url, payload, callback) {
-    return _sender(true, url, payload, callback);
 };
diff --git a/lib/trans-xhr-streaming.js b/lib/trans-xhr-streaming.js
index 06a103b..0e1f259 100644
--- a/lib/trans-xhr-streaming.js
+++ b/lib/trans-xhr-streaming.js
@@ -6,7 +6,7 @@ AjaxBasedTransport.prototype.run = function(ri, trans_url,
     var that = this;
     that.ri = ri;
     that.trans_url = trans_url;
-    that.send_constructor(xdrSender, AjaxObject);
+    that.send_constructor(createAjaxSender(AjaxObject));
     that.poll = new Polling(ri, Receiver,
                             trans_url + url_suffix, AjaxObject);
 };

-- 
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