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:
parent
6e9ea3a5d1
commit
965ae4e5bb
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue