[Pkg-javascript-commits] [sockjs-client] 285/434: Abstract creating of cors ajaxe objects

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:19 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 c9d6650e0b903b1abec489a99ebdb3d2a291fb21
Author: Marek Majkowski <majek04 at gmail.com>
Date:   Wed Jan 11 16:25:27 2012 +0000

    Abstract creating of cors ajaxe objects
---
 lib/dom2.js | 8 ++++++++
 lib/info.js | 3 +--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/dom2.js b/lib/dom2.js
index 83f7268..56108a1 100644
--- a/lib/dom2.js
+++ b/lib/dom2.js
@@ -130,3 +130,11 @@ XDRObject.prototype.close = function() {
     that.nuke();
     that._cleanup(true);
 };
+
+utils.createXHR = function(cors, method, url, payload) {
+    var XHRConstructor = XHRObject;
+    if (cors) {
+        XHRConstructor = _window.XDomainRequest ? XDRObject : XHRObject;
+    }
+    return new XHRConstructor(method, url, payload);
+};
diff --git a/lib/info.js b/lib/info.js
index 3782174..6ace492 100644
--- a/lib/info.js
+++ b/lib/info.js
@@ -9,8 +9,7 @@ InfoReceiver.prototype = new EventEmitter(['finish']);
 
 InfoReceiver.prototype.doXhr = function() {
     var that = this;
-    var XHRObject = _window.XDomainRequest ? utils.XDRObject : utils.XHRObject;
-    var xo = new XHRObject('GET', that.base_url + '/info' , null);
+    var xo = utils.createXHR(true, 'GET', that.base_url + '/info' , null);
     xo.onfinish = function(status, text) {
         if (status === 200) {
             var rtt = (new Date()).getTime() - that.t0;

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