Commit 9ff505fd authored by JC Brand's avatar JC Brand

Add unregisterGlobalEventHandlers method

And call it when `converse.initialize` gets called again
parent 003af0c4
......@@ -62948,6 +62948,12 @@ function finishInitialization() {
}
}
function unregisterGlobalEventHandlers() {
document.removeEventListener("visibilitychange", _converse.saveWindowState);
_converse.emit('registeredGlobalEventHandlers');
}
function cleanup() {
// Looks like _converse.initialized was called again without logging
// out or disconnecting in the previous session.
......@@ -62956,6 +62962,7 @@ function cleanup() {
_converse.chatboxviews.closeAllChatBoxes();
unregisterGlobalEventHandlers();
window.localStorage.clear();
window.sessionStorage.clear();
......@@ -433,12 +433,18 @@ function finishInitialization () {
}
function unregisterGlobalEventHandlers () {
document.removeEventListener("visibilitychange", _converse.saveWindowState);
_converse.emit('registeredGlobalEventHandlers');
}
function cleanup () {
// Looks like _converse.initialized was called again without logging
// out or disconnecting in the previous session.
// This happens in tests. We therefore first clean up.
Backbone.history.stop();
_converse.chatboxviews.closeAllChatBoxes();
unregisterGlobalEventHandlers();
window.localStorage.clear();
window.sessionStorage.clear();
if (_converse.bookmarks) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment