aboutsummaryrefslogtreecommitdiff
path: root/src/content/operators/impls/FocusOperatorFactoryChain.ts
blob: c89c1e5d7851f5055057f93bc0e988a83cb42306 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { inject, injectable } from "tsyringe";
import OperatorFactoryChain from "../OperatorFactoryChain";
import Operator from "../Operator";
import FocusOperator from "./FocusOperator";
import FocusPresenter from "../../presenters/FocusPresenter";
import * as operations from "../../../shared/operations";

@injectable()
export default class FocusOperatorFactoryChain implements OperatorFactoryChain {
  constructor(
    @inject("FocusPresenter")
    private readonly focusPresenter: FocusPresenter
  ) {}

  create(op: operations.Operation, _repeat: number): Operator | null {
    switch (op.type) {
      case operations.FOCUS_INPUT:
        return new FocusOperator(this.focusPresenter);
    }
    return null;
  }
}