blob: 6d3fadcf9f1d1dc9b01a1b721ab1f3ae2d1e779b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import { inject, injectable } from "tsyringe";
import Operator from "../Operator";
import OperatorFactoryChain from "../OperatorFactoryChain";
import FollowMasterClient from "../../client/FollowMasterClient";
import * as operations from "../../../shared/operations";
export class StartFollowOperator implements Operator {
constructor(
private readonly followMasterClient: FollowMasterClient,
private readonly newTab: boolean,
private readonly background: boolean
) {}
async run(): Promise<void> {
this.followMasterClient.startFollow(this.newTab, this.background);
}
}
@injectable()
export class FollowOperatorFactoryChain implements OperatorFactoryChain {
constructor(
@inject("FollowMasterClient")
private followMasterClient: FollowMasterClient
) {}
create(op: operations.Operation, _repeat: number): Operator | null {
switch (op.type) {
case operations.FOLLOW_START:
return new StartFollowOperator(
this.followMasterClient,
op.newTab,
op.background
);
}
return null;
}
}
|