diff options
Diffstat (limited to 'src/background/operators/impls/RepeatOperatorFactoryChain.ts')
-rw-r--r-- | src/background/operators/impls/RepeatOperatorFactoryChain.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/background/operators/impls/RepeatOperatorFactoryChain.ts b/src/background/operators/impls/RepeatOperatorFactoryChain.ts new file mode 100644 index 0000000..5038d48 --- /dev/null +++ b/src/background/operators/impls/RepeatOperatorFactoryChain.ts @@ -0,0 +1,29 @@ +import { inject, injectable } from "tsyringe"; +import Operator from "../Operator"; +import OperatorFactoryChain from "../OperatorFactoryChain"; +import RepeatLastOperator from "./RepeatLastOperator"; +import RepeatRepository from "../../repositories/RepeatRepository"; +import OperatorFactory from "../OperatorFactory"; +import * as operations from "../../../shared/operations"; + +@injectable() +export default class RepeatOperatorFactoryChain + implements OperatorFactoryChain { + constructor( + @inject("RepeatRepository") + private readonly repeatRepository: RepeatRepository, + @inject("OperatorFactory") + private readonly operatorFactory: OperatorFactory + ) {} + + create(op: operations.Operation): Operator | null { + switch (op.type) { + case operations.REPEAT_LAST: + return new RepeatLastOperator( + this.repeatRepository, + this.operatorFactory + ); + } + return null; + } +} |