aboutsummaryrefslogtreecommitdiff
path: root/src/content/controllers/FollowSlaveController.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-05-19 09:26:52 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-05-19 09:26:52 +0900
commite0c4182f14f908d13c8c814c7bc2b48a1791f881 (patch)
treea277179d51013c4a2384f076197a1dbcc442d2d0 /src/content/controllers/FollowSlaveController.ts
parent5b7f7f5dbd94b5bce7aee4667add187ffb9944f2 (diff)
Follow as a clean architecture
Diffstat (limited to 'src/content/controllers/FollowSlaveController.ts')
-rw-r--r--src/content/controllers/FollowSlaveController.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/content/controllers/FollowSlaveController.ts b/src/content/controllers/FollowSlaveController.ts
new file mode 100644
index 0000000..88dccf3
--- /dev/null
+++ b/src/content/controllers/FollowSlaveController.ts
@@ -0,0 +1,32 @@
+import * as messages from '../../shared/messages';
+import FollowSlaveUseCase from '../usecases/FollowSlaveUseCase';
+
+export default class FollowSlaveController {
+ private usecase: FollowSlaveUseCase;
+
+ constructor({
+ usecase = new FollowSlaveUseCase(),
+ } = {}) {
+ this.usecase = usecase;
+ }
+
+ countTargets(m: messages.FollowRequestCountTargetsMessage): void {
+ this.usecase.countTargets(m.viewSize, m.framePosition);
+ }
+
+ createHints(m: messages.FollowCreateHintsMessage): void {
+ this.usecase.createHints(m.viewSize, m.framePosition, m.tags);
+ }
+
+ showHints(m: messages.FollowShowHintsMessage): void {
+ this.usecase.showHints(m.prefix);
+ }
+
+ activate(m: messages.FollowActivateMessage): void {
+ this.usecase.activate(m.tag, m.newTab, m.background);
+ }
+
+ clear(_m: messages.FollowRemoveHintsMessage) {
+ this.usecase.clear();
+ }
+}