Skip to content

Commit

Permalink
Fixes �#32
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Nov 10, 2014
1 parent ffe0971 commit 08f490b
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/javascript/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,19 @@
// Main initialization code
/////////////////////////////////////////////////////////////////////////////

function _onLoad() {
var loaded = false;
document.addEventListener('DOMContentLoaded', function() {
if ( loaded ) { return; }
loaded = true;
OSjs.Core.initialize();
}

function _onUnload() {
});
document.addEventListener('load', function() {
if ( loaded ) { return; }
loaded = true;
OSjs.Core.initialize();
});
document.addEventListener('unload', function() {
OSjs.Core.shutdown(false, true);
}

var jQuery = window.$ || window.jQuery;
if ( typeof jQuery !== 'undefined' ) {
console.warn('Using jQuery initialization');
jQuery(window).on('load', _onLoad);
jQuery(window).on('unload', _onUnload);
} else {
window.onload = _onLoad;
window.onunload = _onUnload;
}
});

})();

0 comments on commit 08f490b

Please sign in to comment.