Put a parent event bus to pageInfo

This commit is contained in:
Tamius Han 2022-05-06 00:23:01 +02:00
parent 4b44efe6fc
commit 74fe85f3a2
3 changed files with 9 additions and 1 deletions

View File

@ -135,7 +135,7 @@ export default class UWContent {
if (this.actionHandler) { if (this.actionHandler) {
this.actionHandler.destroy(); this.actionHandler.destroy();
} }
this.actionHandler = new ActionHandler(this.pageInfo); this.actionHandler = new ActionHandler(this.pageInfo.eventBus, this.settings, this.logger);
this.actionHandler.init(); this.actionHandler.init();
this.logger.log('info', 'debug', "[uw.js::setup] ActionHandler initiated."); this.logger.log('info', 'debug', "[uw.js::setup] ActionHandler initiated.");

View File

@ -7,6 +7,7 @@ import Logger from '../Logger';
import Settings from '../Settings'; import Settings from '../Settings';
import ExtensionMode from '../../../common/enums/ExtensionMode.enum'; import ExtensionMode from '../../../common/enums/ExtensionMode.enum';
import CommsClient from '../comms/CommsClient'; import CommsClient from '../comms/CommsClient';
import EventBus from '../EventBus';
if (process.env.CHANNEL !== 'stable'){ if (process.env.CHANNEL !== 'stable'){
console.info("Loading PageInfo"); console.info("Loading PageInfo");
@ -51,6 +52,7 @@ class PageInfo {
logger: Logger; logger: Logger;
settings: Settings; settings: Settings;
comms: CommsClient; comms: CommsClient;
eventBus: EventBus;
videos: {videoData: VideoData, element: HTMLVideoElement}[] = []; videos: {videoData: VideoData, element: HTMLVideoElement}[] = [];
//#endregion //#endregion
@ -73,6 +75,8 @@ class PageInfo {
this.extensionMode = extensionMode; this.extensionMode = extensionMode;
this.readOnly = readOnly; this.readOnly = readOnly;
this.eventBus = new EventBus();
if (comms){ if (comms){
this.comms = comms; this.comms = comms;
} }

View File

@ -90,6 +90,10 @@ class VideoData {
this.eventBus = new EventBus(); this.eventBus = new EventBus();
if (pageInfo.eventBus) {
this.eventBus.setUpstreamBus(pageInfo.eventBus);
}
this.setupStageOne(); this.setupStageOne();
} }