Api: Take care of private app.js instances, make sure they're included in iteration.

Iterate over all app.js instances (public & private) using:
for (var app_obj of window.EgwApp) {...}
This commit is contained in:
nathangray
2020-04-21 15:36:17 -06:00
parent 16e3b2cd05
commit 444babdbc8
7 changed files with 101 additions and 13 deletions

View File

@@ -74,6 +74,7 @@
*/
Object.defineProperty(exports, "__esModule", { value: true });
var et2_core_baseWidget_1 = require("./et2_core_baseWidget");
var egw_app_1 = require("../jsapi/egw_app");
/**
* The etemplate2 class manages a certain etemplate2 instance.
*
@@ -196,6 +197,14 @@ var etemplate2 = /** @class */ (function () {
}
}
}
// If using a private app object, remove all of them
if (this.app_obj !== window.app) {
for (var app_name in this.app_obj) {
if (this.app_obj[app_name] instanceof egw_app_1.EgwApp) {
this.app_obj[app_name].destroy();
}
}
}
};
Object.defineProperty(etemplate2.prototype, "widgetContainer", {
get: function () {
@@ -383,8 +392,6 @@ var etemplate2 = /** @class */ (function () {
app[appname].et2_ready(_et2, _name);
};
}
// Clear any existing instance
this.clear();
// Create the basic widget container and attach it to the DOM
this._widgetContainer = new et2_core_baseWidget_1.et2_container(null);
this._widgetContainer.setApiInstance(egw(currentapp, egw.elemWindow(this._DOMContainer)));