summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorPeter 'Pita' Martischka <petermartischka@googlemail.com>2012-02-27 17:33:27 +0100
committerPeter 'Pita' Martischka <petermartischka@googlemail.com>2012-02-27 17:33:27 +0100
commitd00be5b8172af29e78e11b219b3a3ea5ef59611d (patch)
treec9a15317c4de5d0c2f23d10dfe97a6a9caf6ea57 /static
parent0c770526982104d392284c4b1e2612794bf09e67 (diff)
downloadetherpad-lite-d00be5b8172af29e78e11b219b3a3ea5ef59611d.zip
Removed all window.unload event handlers. This kind of fixes #200
Diffstat (limited to 'static')
-rw-r--r--static/js/ace2_inner.js1
-rw-r--r--static/js/collab_client.js7
-rw-r--r--static/js/pad.js28
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()
{