diff options
Diffstat (limited to 'src/background/controllers')
-rw-r--r-- | src/background/controllers/ConsoleController.ts | 6 | ||||
-rw-r--r-- | src/background/controllers/ConsoleFrameClient.ts | 15 | ||||
-rw-r--r-- | src/background/controllers/ConsoleUseCase.ts | 21 |
3 files changed, 3 insertions, 39 deletions
diff --git a/src/background/controllers/ConsoleController.ts b/src/background/controllers/ConsoleController.ts index 11ee09d..2a0d75f 100644 --- a/src/background/controllers/ConsoleController.ts +++ b/src/background/controllers/ConsoleController.ts @@ -1,11 +1,11 @@ import { injectable } from "tsyringe"; -import ConsoleUseCase from "./ConsoleUseCase"; +import ConsoleUseCase from "../usecases/ConsoleUseCase"; @injectable() export default class ConsoleController { constructor(private readonly consoleUseCase: ConsoleUseCase) {} - resize(width: number, height: number) { - return this.consoleUseCase.resize(width, height); + resize(senderTabId: number, width: number, height: number) { + return this.consoleUseCase.resize(senderTabId, width, height); } } diff --git a/src/background/controllers/ConsoleFrameClient.ts b/src/background/controllers/ConsoleFrameClient.ts deleted file mode 100644 index 170566d..0000000 --- a/src/background/controllers/ConsoleFrameClient.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as messages from "../../shared/messages"; - -export default interface ConsoleFrameClient { - resize(tabId: number, width: number, height: number): Promise<void>; -} - -export class ConsoleFrameClientImpl implements ConsoleFrameClient { - async resize(tabId: number, width: number, height: number): Promise<void> { - await browser.tabs.sendMessage(tabId, { - type: messages.CONSOLE_RESIZE, - width, - height, - }); - } -} diff --git a/src/background/controllers/ConsoleUseCase.ts b/src/background/controllers/ConsoleUseCase.ts deleted file mode 100644 index 556aaf8..0000000 --- a/src/background/controllers/ConsoleUseCase.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { inject, injectable } from "tsyringe"; -import ConsoleFrameClient from "./ConsoleFrameClient"; -import TabPresenter from "../presenters/TabPresenter"; - -@injectable() -export default class ConsoleUseCase { - constructor( - @inject("TabPresenter") - private readonly tabPresenter: TabPresenter, - @inject("ConsoleFrameClient") - private readonly consoleFrameClient: ConsoleFrameClient - ) {} - - async resize(width: number, height: number): Promise<void> { - const tabId = (await this.tabPresenter.getCurrent()).id; - if (typeof tabId === "undefined") { - return; - } - return this.consoleFrameClient.resize(tabId, width, height); - } -} |