[Pkg-javascript-commits] [sockjs-client] 184/350: Switch to better iframe close

tonnerre at ancient-solutions.com tonnerre at ancient-solutions.com
Fri Aug 5 01:04:19 UTC 2016


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.

commit c06d11518f67d25ddf04ad2ce72e8098d2729d91
Author: Bryce Kahle <bkahle at gmail.com>
Date:   Sun Oct 19 22:42:15 2014 -0400

    Switch to better iframe close
---
 lib/facade.js               | 4 ++--
 lib/transport/iframe.js     | 4 ++++
 lib/transport/lib/frames.js | 9 ---------
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/lib/facade.js b/lib/facade.js
index d12a28b..e4599cd 100644
--- a/lib/facade.js
+++ b/lib/facade.js
@@ -1,6 +1,6 @@
 'use strict';
 
-var frameDefs = require('./transport/lib/frames')
+var JSON3 = require('json3')
   , iframeUtils = require('./utils/iframe')
   ;
 
@@ -11,7 +11,7 @@ function FacadeJS(transport) {
 }
 
 FacadeJS.prototype._transportClose = function (code, reason) {
-  iframeUtils.postMessage('t', frameDefs.close(code, reason));
+  iframeUtils.postMessage('c', JSON3.stringify([code, reason]));
 };
 FacadeJS.prototype._transportMessage = function (frame) {
   iframeUtils.postMessage('t', frame);
diff --git a/lib/transport/iframe.js b/lib/transport/iframe.js
index 3af3579..80d56b4 100644
--- a/lib/transport/iframe.js
+++ b/lib/transport/iframe.js
@@ -93,6 +93,10 @@ IframeTransport.prototype._message = function(e) {
   case 't':
     this.emit('message', iframeMessage.data);
     break;
+  case 'c':
+    var cdata = JSON.parse(iframeMessage.data);
+    this.emit('close', cdata[0], cdata[1]);
+    break;
   }
 };
 
diff --git a/lib/transport/lib/frames.js b/lib/transport/lib/frames.js
deleted file mode 100644
index 52da06a..0000000
--- a/lib/transport/lib/frames.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-var JSON3 = require('json3');
-
-module.exports = {
-  close: function (code, reason) {
-    return 'c' + JSON3.stringify([code, reason]);
-  }
-};

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