From 04ebd1e5331d29b2413c174ae0fe9d73566b3b8d Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 14 Mar 2021 22:57:56 +0900 Subject: Resize console dynamically --- src/background/controllers/ConsoleUseCase.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/background/controllers/ConsoleUseCase.ts (limited to 'src/background/controllers/ConsoleUseCase.ts') diff --git a/src/background/controllers/ConsoleUseCase.ts b/src/background/controllers/ConsoleUseCase.ts new file mode 100644 index 0000000..556aaf8 --- /dev/null +++ b/src/background/controllers/ConsoleUseCase.ts @@ -0,0 +1,21 @@ +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 { + const tabId = (await this.tabPresenter.getCurrent()).id; + if (typeof tabId === "undefined") { + return; + } + return this.consoleFrameClient.resize(tabId, width, height); + } +} -- cgit v1.2.3