aboutsummaryrefslogtreecommitdiff
path: root/src/background/controllers/ConsoleUseCase.ts
blob: 556aaf8fcdd1912d2713f52a903d7f5cb63c0039 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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<void> {
    const tabId = (await this.tabPresenter.getCurrent()).id;
    if (typeof tabId === "undefined") {
      return;
    }
    return this.consoleFrameClient.resize(tabId, width, height);
  }
}