From 809bdb11f3d213254c098411755631b1264c52f0 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sat, 28 Nov 2020 13:25:47 +0900 Subject: Make operators as a strategy pattern --- .../operators/impls/BackgroundOperationOperator.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/content/operators/impls/BackgroundOperationOperator.ts (limited to 'src/content/operators/impls/BackgroundOperationOperator.ts') diff --git a/src/content/operators/impls/BackgroundOperationOperator.ts b/src/content/operators/impls/BackgroundOperationOperator.ts new file mode 100644 index 0000000..dd86559 --- /dev/null +++ b/src/content/operators/impls/BackgroundOperationOperator.ts @@ -0,0 +1,15 @@ +import Operator from "../Operator"; +import OperationClient from "../../client/OperationClient"; +import * as operations from "../../../shared/operations"; + +export default class BackgroundOperationOperator implements Operator { + constructor( + private readonly operationClient: OperationClient, + private readonly repeat: number, + private readonly op: operations.Operation + ) {} + + async run(): Promise { + await this.operationClient.execBackgroundOp(this.repeat, this.op); + } +} -- cgit v1.2.3