Removed all window.unload event handlers. This kind of fixes #200

This commit is contained in:
Peter 'Pita' Martischka 2012-02-27 17:33:27 +01:00
parent 0c77052698
commit d00be5b817
3 changed files with 14 additions and 22 deletions

View File

@ -4654,7 +4654,6 @@ function Ace2Inner(){
function bindTheEventHandlers()
{
bindEventHandler(window, "unload", teardown);
bindEventHandler(document, "keydown", handleKeyEvent);
bindEventHandler(document, "keypress", handleKeyEvent);
bindEventHandler(document, "keyup", handleKeyEvent);

View File

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

View File

@ -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()
{