diff --git a/src/main/_ioc.ts b/src/main/_ioc.ts index 9f99c99..6d5311c 100644 --- a/src/main/_ioc.ts +++ b/src/main/_ioc.ts @@ -11,16 +11,10 @@ async function destroyAll() { await destroyAllCommand(_ioc) } -const _modulesIOC = new Container() -_modulesIOC.load(iocModules) - -const _commandIOC = _modulesIOC.createChild() -_commandIOC.load(iocCommand) - -const _controllerIOC = _commandIOC.createChild() -_controllerIOC.load(iocController) - -const _ioc = _controllerIOC.createChild() +const _ioc = new Container() +_ioc.load(iocModules) +_ioc.load(iocCommand) +_ioc.load(iocController) _ioc.bind(IOC).toSelf().inSingletonScope() _ioc.bind(App).toSelf().inSingletonScope() diff --git a/src/main/commands/BasicCommand.ts b/src/main/commands/BasicCommand.ts index 44ebb6d..4e6ee79 100644 --- a/src/main/commands/BasicCommand.ts +++ b/src/main/commands/BasicCommand.ts @@ -6,7 +6,7 @@ import WindowManager from "main/modules/window-manager" export default class BasicCommand { constructor( @inject(WindowManager) private _WindowManager: WindowManager, - @inject(Tabs) private _Tabs: Tabs + @inject(Tabs) private _Tabs: Tabs, ) { // } diff --git a/src/main/commands/TabsCommand.ts b/src/main/commands/TabsCommand.ts index 044ceba..e97c9f2 100644 --- a/src/main/commands/TabsCommand.ts +++ b/src/main/commands/TabsCommand.ts @@ -12,6 +12,10 @@ class TabsCommand { this._Tabs.events.on("update", this.listenerTabActive) } + listenerTabActive() { + broadcast("main:TabsCommand.update", this.getAllTabs()) + } + bindElement(rect) { this._Tabs.updateRect(rect) } @@ -27,10 +31,6 @@ class TabsCommand { } } - listenerTabActive() { - broadcast("TabsCommand.update", this.getAllTabs()) - } - add(url) { this._Tabs.add(url, true, this._WindowManager.getMainWindow()!) } diff --git a/src/renderer/src/pages/_ui/Browser.vue b/src/renderer/src/pages/_ui/Browser.vue index 225fa4d..5d0e20c 100644 --- a/src/renderer/src/pages/_ui/Browser.vue +++ b/src/renderer/src/pages/_ui/Browser.vue @@ -45,9 +45,9 @@ const listener = (_, v) => { } } if (import.meta.hot) { - api.off("TabsCommand.update", listener) + api.off("main:TabsCommand.update", listener) } -api.on("TabsCommand.update", listener) +api.on("main:TabsCommand.update", listener) onMounted(() => { api.call("TabsCommand.sync") })