Window unload event support for most browsers

* Also fixes "Webserver gone away" sometimes appearing on page reload
This commit is contained in:
Thomas Gelf 2014-02-21 10:17:41 +00:00
parent 072eda70c4
commit f20f27927d
1 changed files with 10 additions and 0 deletions

View File

@ -48,6 +48,8 @@
// We catch resize events
$(window).on('resize', { self: this }, this.onWindowResize);
$( window ).on('unload', { self: this }, this.onUnload);
// We catch scroll events in our containers
$('.container').on('scroll', icinga.events.onContainerScroll);
@ -71,6 +73,13 @@
// $(document).on('change', 'form.auto select', this.submitForm);
},
onUnload: function(event)
{
var icinga = event.data.self.icinga;
icinga.logger.info('Unloading Icinga');
icinga.destroy();
},
historyChanged: function(event)
{
var icinga = event.data.self.icinga;
@ -228,6 +237,7 @@
{
$(window).off('popstate', this.historyChanged);
$(window).off('resize', this.onWindowResize);
$(window).off('unload', this.onUnload);
$(document).off('scroll', '.container', this.onContainerScroll);
$(document).off('click', 'a', this.linkClicked);
$(document).off('click', 'tr[href]', this.linkClicked);