Destroy old pageInfo instance when initializing WU

This commit is contained in:
Tamius Han 2020-10-21 23:52:49 +02:00
parent 28c12861e5
commit 43a86a7495

View File

@ -155,6 +155,10 @@ class UW {
}
try {
if (this.pageInfo) {
this.logger.log('info', 'debug', '[uw.js::setup] An instance of pageInfo already exists and will be destroyed.');
this.pageInfo.destroy();
}
this.pageInfo = new PageInfo(this.comms, this.settings, this.logger, extensionMode, isSiteDisabled);
this.logger.log('info', 'debug', "[uw.js::setup] pageInfo initialized.");
@ -162,6 +166,9 @@ class UW {
// start action handler only if extension is enabled for this site
if (!isSiteDisabled) {
if (this.actionHandler) {
this.actionHandler.destroy();
}
this.actionHandler = new ActionHandler(this.pageInfo);
this.actionHandler.init();