aboutsummaryrefslogtreecommitdiff
path: root/src/content/controllers/FollowKeyController.ts
blob: eb45e01c85aca31670c3f8556d96f7da027c02bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import FollowSlaveUseCase from '../usecases/FollowSlaveUseCase';
import Key from '../domains/Key';

export default class FollowKeyController {
  private followSlaveUseCase: FollowSlaveUseCase;

  constructor({
    followSlaveUseCase = new FollowSlaveUseCase(),
  } = {}) {
    this.followSlaveUseCase = followSlaveUseCase;
  }

  press(key: Key): boolean {
    if (!this.followSlaveUseCase.isFollowMode()) {
      return false;
    }

    this.followSlaveUseCase.sendKey(key);
    return true;
  }
}