Find as a controller
This commit is contained in:
parent
ad1f3c07fb
commit
fcd15f4f09
9 changed files with 78 additions and 75 deletions
24
src/content/controllers/FindController.ts
Normal file
24
src/content/controllers/FindController.ts
Normal file
|
@ -0,0 +1,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();
|
||||
}
|
||||
}
|
Reference in a new issue