diff options
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/background/clients/ConsoleFrameClient.ts (renamed from src/background/controllers/ConsoleFrameClient.ts) | 0 | ||||
-rw-r--r-- | src/background/controllers/ConsoleController.ts | 6 | ||||
-rw-r--r-- | src/background/controllers/ConsoleUseCase.ts | 21 | ||||
-rw-r--r-- | src/background/di.ts | 2 | ||||
-rw-r--r-- | src/background/infrastructures/ContentMessageListener.ts | 14 | ||||
-rw-r--r-- | src/background/usecases/ConsoleUseCase.ts | 14 |
7 files changed, 30 insertions, 29 deletions
diff --git a/package.json b/package.json index 0832441..30b1f84 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "lint:fix": "eslint --ext .ts,.tsx . --fix", "type-checks": "tsc --noEmit", "test": "karma start", - "test:e2e": "mocha --timeout 10000 --retries 10 --require ts-node/register --extension ts e2e" + "test:e2e": "mocha --timeout 20000 --retries 10 --require ts-node/register --extension ts e2e" }, "repository": { "type": "git", diff --git a/src/background/controllers/ConsoleFrameClient.ts b/src/background/clients/ConsoleFrameClient.ts index 170566d..170566d 100644 --- a/src/background/controllers/ConsoleFrameClient.ts +++ b/src/background/clients/ConsoleFrameClient.ts 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/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); - } -} diff --git a/src/background/di.ts b/src/background/di.ts index 3c43d2d..a571c7d 100644 --- a/src/background/di.ts +++ b/src/background/di.ts @@ -18,7 +18,7 @@ import { BrowserSettingRepositoryImpl } from "./repositories/BrowserSettingRepos import { RepeatRepositoryImpl } from "./repositories/RepeatRepository"; import { ZoomPresenterImpl } from "./presenters/ZoomPresenter"; import { WindowPresenterImpl } from "./presenters/WindowPresenter"; -import { ConsoleFrameClientImpl } from "./controllers/ConsoleFrameClient"; +import { ConsoleFrameClientImpl } from "./clients/ConsoleFrameClient"; container.register("LocalSettingRepository", { useClass: LocalSettingRepository, diff --git a/src/background/infrastructures/ContentMessageListener.ts b/src/background/infrastructures/ContentMessageListener.ts index ec87938..6023047 100644 --- a/src/background/infrastructures/ContentMessageListener.ts +++ b/src/background/infrastructures/ContentMessageListener.ts @@ -81,7 +81,11 @@ export default class ContentMessageListener { case messages.CONSOLE_ENTER_COMMAND: return this.onConsoleEnterCommand(message.text); case messages.CONSOLE_RESIZE: - return this.onConsoleResize(message.width, message.height); + return this.onConsoleResize( + senderTab.id!, + message.width, + message.height + ); case messages.SETTINGS_QUERY: return this.onSettingsQuery(); case messages.FIND_GET_KEYWORD: @@ -116,8 +120,12 @@ export default class ContentMessageListener { return this.commandController.exec(text); } - onConsoleResize(width: number, height: number): Promise<void> { - return this.consoleController.resize(width, height); + onConsoleResize( + senderTabId: number, + width: number, + height: number + ): Promise<void> { + return this.consoleController.resize(senderTabId, width, height); } async onSettingsQuery(): Promise<unknown> { diff --git a/src/background/usecases/ConsoleUseCase.ts b/src/background/usecases/ConsoleUseCase.ts new file mode 100644 index 0000000..7b461e5 --- /dev/null +++ b/src/background/usecases/ConsoleUseCase.ts @@ -0,0 +1,14 @@ +import { inject, injectable } from "tsyringe"; +import ConsoleFrameClient from "../clients/ConsoleFrameClient"; + +@injectable() +export default class ConsoleUseCase { + constructor( + @inject("ConsoleFrameClient") + private readonly consoleFrameClient: ConsoleFrameClient + ) {} + + async resize(tabId: number, width: number, height: number): Promise<void> { + return this.consoleFrameClient.resize(tabId, width, height); + } +} |