Initial commit of icinga.reload, this allows as to replace JS at runtime

* Works only with minified JS right now as it loads only a single file file
This commit is contained in:
Thomas Gelf 2014-03-26 09:28:03 +00:00
parent 6e9ea3a5d1
commit 965ae4e5bb
1 changed files with 29 additions and 0 deletions

View File

@ -149,7 +149,36 @@
this.modules = [];
this.timer = this.events = this.loader = this.ui = this.logger =
this.utils = null;
},
reload: function () {
setTimeout(function () {
var oldjQuery = window.jQuery;
var oldConfig = window.icinga.config;
var oldIcinga = window.Icinga;
window.icinga.destroy();
window.Icinga = undefined;
window.$ = undefined;
window.jQuery = undefined;
oldjQuery.getScript(
oldConfig.baseUrl + 'js/icinga.min.js'
).done(function () {
window.jQuery = oldjQuery;
window.$ = window.jQuery;
window.Icinga = oldIcinga;
window.icinga = new Icinga(oldConfig);
window.icinga.ui.reloadCss();
oldjQuery = undefined;
oldConfig = undefined;
oldIcinga = undefined;
}).fail(function () {
window.icinga = new Icinga(oldConfig);
window.icinga.ui.reloadCss();
});
}, 0);
}
};
window.Icinga = Icinga;