diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/js/ace2_inner.js | 1 | ||||
-rw-r--r-- | static/js/collab_client.js | 7 | ||||
-rw-r--r-- | static/js/pad.js | 28 |
3 files changed, 14 insertions, 22 deletions
diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 2418b384..71f7d20f 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -4654,7 +4654,6 @@ function Ace2Inner(){ function bindTheEventHandlers() { - bindEventHandler(window, "unload", teardown); bindEventHandler(document, "keydown", handleKeyEvent); bindEventHandler(document, "keypress", handleKeyEvent); bindEventHandler(document, "keyup", handleKeyEvent); diff --git a/static/js/collab_client.js b/static/js/collab_client.js index ec575fe0..bb68f604 100644 --- a/static/js/collab_client.js +++ b/static/js/collab_client.js @@ -84,13 +84,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) {} }; - $(window).bind("unload", function() - { - if (getSocket()) - { - setChannelState("DISCONNECTED", "unload"); - } - }); if ($.browser.mozilla) { // Prevent "escape" from taking effect and canceling a comet connection; diff --git a/static/js/pad.js b/static/js/pad.js index d6bb4c71..058213ce 100644 --- a/static/js/pad.js +++ b/static/js/pad.js @@ -164,7 +164,8 @@ function handshake() //connect socket = pad.socket = io.connect(url, { resource: resource, - 'max reconnection attempts': 3 + 'max reconnection attempts': 3, + 'sync disconnect on unload' : false }); function sendClientReady(isReconnect) @@ -222,15 +223,19 @@ function handshake() sendClientReady(true); }); - socket.on('disconnect', function () { - function disconnectEvent() - { - pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout"); + socket.on('disconnect', function (reason) { + if(reason == "booted"){ + pad.collabClient.setChannelState("DISCONNECTED"); + } else { + function disconnectEvent() + { + pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout"); + } + + pad.collabClient.setChannelState("RECONNECTING"); + + disconnectTimeout = setTimeout(disconnectEvent, 10000); } - - pad.collabClient.setChannelState("RECONNECTING"); - - disconnectTimeout = setTimeout(disconnectEvent, 10000); }); var receivedClientVars = false; @@ -396,11 +401,6 @@ var pad = { getParams(); handshake(); }); - - $(window).unload(function() - { - pad.dispose(); - }); }, _afterHandshake: function() { |