aboutsummaryrefslogtreecommitdiff
path: root/src/background/usecases/FindUseCase.ts
blob: d56780035ceb3ab2d72f868c4c52184fd6879ec4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import FindRepository from '../repositories/FindRepository';
import TabPresenter from '../presenters/TabPresenter';
import ConsoleClient from '../infrastructures/ConsoleClient';

export default class FindUseCase {
  private tabPresenter: TabPresenter;

  private findRepository: FindRepository;

  private consoleClient: ConsoleClient;

  constructor() {
    this.tabPresenter = new TabPresenter();
    this.findRepository = new FindRepository();
    this.consoleClient = new ConsoleClient();
  }

  getKeyword(): Promise<string> {
    return this.findRepository.getKeyword();
  }

  setKeyword(keyword: string): Promise<any> {
    return this.findRepository.setKeyword(keyword);
  }

  async findStart(): Promise<any> {
    let tab = await this.tabPresenter.getCurrent();
    return this.consoleClient.showFind(tab.id as number);
  }
}