aboutsummaryrefslogtreecommitdiff
path: root/src/content/controllers/FindController.ts
blob: cf27a8dbd60b5337eb4c4147bd54a6fbf91c17c8 (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
import * as messages from '../../shared/messages';
import FindUseCase from '../usecases/FindUseCase';

export default class FindController {
  private findUseCase: FindUseCase;

  constructor({
    findUseCase = new FindUseCase(),
  } = {}) {
    this.findUseCase = findUseCase;
  }

  async start(m: messages.ConsoleEnterFindMessage): Promise<void> {
    await this.findUseCase.startFind(m.text);
  }

  async next(_: messages.FindNextMessage): Promise<void> {
    await this.findUseCase.findNext();
  }

  async prev(_: messages.FindPrevMessage): Promise<void> {
    await this.findUseCase.findPrev();
  }
}