aboutsummaryrefslogtreecommitdiff
path: root/src/content/controllers
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-04-13 20:37:36 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2020-04-13 20:37:36 +0900
commite1dac618a8b8929f601c7ec8aca3842c5ebf9d03 (patch)
tree6a914a8243c8c02e7752a83667a54d3fa832955c /src/content/controllers
parent685f2b7b69218b06b5bb676069e35f79c5048c9b (diff)
Use plugin:prettier/recommended
Diffstat (limited to 'src/content/controllers')
-rw-r--r--src/content/controllers/AddonEnabledController.ts13
-rw-r--r--src/content/controllers/ConsoleFrameController.ts11
-rw-r--r--src/content/controllers/FindController.ts11
-rw-r--r--src/content/controllers/FollowKeyController.ts11
-rw-r--r--src/content/controllers/FollowMasterController.ts17
-rw-r--r--src/content/controllers/FollowSlaveController.ts11
-rw-r--r--src/content/controllers/KeymapController.ts114
-rw-r--r--src/content/controllers/MarkController.ts11
-rw-r--r--src/content/controllers/MarkKeyController.ts13
-rw-r--r--src/content/controllers/NavigateController.ts11
-rw-r--r--src/content/controllers/SettingController.ts14
11 files changed, 104 insertions, 133 deletions
diff --git a/src/content/controllers/AddonEnabledController.ts b/src/content/controllers/AddonEnabledController.ts
index 59b45fa..9ef56a9 100644
--- a/src/content/controllers/AddonEnabledController.ts
+++ b/src/content/controllers/AddonEnabledController.ts
@@ -1,16 +1,13 @@
-import { injectable } from 'tsyringe';
-import * as messages from '../../shared/messages';
-import AddonEnabledUseCase from '../usecases/AddonEnabledUseCase';
+import { injectable } from "tsyringe";
+import * as messages from "../../shared/messages";
+import AddonEnabledUseCase from "../usecases/AddonEnabledUseCase";
@injectable()
export default class AddonEnabledController {
- constructor(
- private addonEnabledUseCase: AddonEnabledUseCase,
- ) {
- }
+ constructor(private addonEnabledUseCase: AddonEnabledUseCase) {}
getAddonEnabled(
- _message: messages.AddonEnabledQueryMessage,
+ _message: messages.AddonEnabledQueryMessage
): Promise<boolean> {
const enabled = this.addonEnabledUseCase.getEnabled();
return Promise.resolve(enabled);
diff --git a/src/content/controllers/ConsoleFrameController.ts b/src/content/controllers/ConsoleFrameController.ts
index ae26b7c..84e0ce6 100644
--- a/src/content/controllers/ConsoleFrameController.ts
+++ b/src/content/controllers/ConsoleFrameController.ts
@@ -1,13 +1,10 @@
-import { injectable } from 'tsyringe';
-import ConsoleFrameUseCase from '../usecases/ConsoleFrameUseCase';
-import * as messages from '../../shared/messages';
+import { injectable } from "tsyringe";
+import ConsoleFrameUseCase from "../usecases/ConsoleFrameUseCase";
+import * as messages from "../../shared/messages";
@injectable()
export default class ConsoleFrameController {
- constructor(
- private consoleFrameUseCase: ConsoleFrameUseCase,
- ) {
- }
+ constructor(private consoleFrameUseCase: ConsoleFrameUseCase) {}
unfocus(_message: messages.Message) {
this.consoleFrameUseCase.unfocus();
diff --git a/src/content/controllers/FindController.ts b/src/content/controllers/FindController.ts
index 7735176..3087d5d 100644
--- a/src/content/controllers/FindController.ts
+++ b/src/content/controllers/FindController.ts
@@ -1,13 +1,10 @@
-import { injectable } from 'tsyringe';
-import * as messages from '../../shared/messages';
-import FindUseCase from '../usecases/FindUseCase';
+import { injectable } from "tsyringe";
+import * as messages from "../../shared/messages";
+import FindUseCase from "../usecases/FindUseCase";
@injectable()
export default class FindController {
- constructor(
- private findUseCase: FindUseCase,
- ) {
- }
+ constructor(private findUseCase: FindUseCase) {}
async start(m: messages.ConsoleEnterFindMessage): Promise<void> {
await this.findUseCase.startFind(m.text);
diff --git a/src/content/controllers/FollowKeyController.ts b/src/content/controllers/FollowKeyController.ts
index 0fd94ff..45d202a 100644
--- a/src/content/controllers/FollowKeyController.ts
+++ b/src/content/controllers/FollowKeyController.ts
@@ -1,13 +1,10 @@
-import { injectable } from 'tsyringe';
-import FollowSlaveUseCase from '../usecases/FollowSlaveUseCase';
-import Key from '../../shared/settings/Key';
+import { injectable } from "tsyringe";
+import FollowSlaveUseCase from "../usecases/FollowSlaveUseCase";
+import Key from "../../shared/settings/Key";
@injectable()
export default class FollowKeyController {
- constructor(
- private followSlaveUseCase: FollowSlaveUseCase,
- ) {
- }
+ constructor(private followSlaveUseCase: FollowSlaveUseCase) {}
press(key: Key): boolean {
if (!this.followSlaveUseCase.isFollowMode()) {
diff --git a/src/content/controllers/FollowMasterController.ts b/src/content/controllers/FollowMasterController.ts
index fa99820..e7895fa 100644
--- a/src/content/controllers/FollowMasterController.ts
+++ b/src/content/controllers/FollowMasterController.ts
@@ -1,30 +1,27 @@
-import { injectable } from 'tsyringe';
-import FollowMasterUseCase from '../usecases/FollowMasterUseCase';
-import * as messages from '../../shared/messages';
+import { injectable } from "tsyringe";
+import FollowMasterUseCase from "../usecases/FollowMasterUseCase";
+import * as messages from "../../shared/messages";
@injectable()
export default class FollowMasterController {
- constructor(
- private followMasterUseCase: FollowMasterUseCase,
- ) {
- }
+ constructor(private followMasterUseCase: FollowMasterUseCase) {}
followStart(m: messages.FollowStartMessage): void {
this.followMasterUseCase.startFollow(m.newTab, m.background);
}
responseCountTargets(
- m: messages.FollowResponseCountTargetsMessage, sender: Window,
+ m: messages.FollowResponseCountTargetsMessage,
+ sender: Window
): void {
this.followMasterUseCase.createSlaveHints(m.count, sender);
}
keyPress(message: messages.FollowKeyPressMessage): void {
- if (message.key === '[' && message.ctrlKey) {
+ if (message.key === "[" && message.ctrlKey) {
this.followMasterUseCase.cancelFollow();
} else {
this.followMasterUseCase.enqueue(message.key);
}
}
}
-
diff --git a/src/content/controllers/FollowSlaveController.ts b/src/content/controllers/FollowSlaveController.ts
index 65ce477..25f0505 100644
--- a/src/content/controllers/FollowSlaveController.ts
+++ b/src/content/controllers/FollowSlaveController.ts
@@ -1,13 +1,10 @@
-import { injectable } from 'tsyringe';
-import * as messages from '../../shared/messages';
-import FollowSlaveUseCase from '../usecases/FollowSlaveUseCase';
+import { injectable } from "tsyringe";
+import * as messages from "../../shared/messages";
+import FollowSlaveUseCase from "../usecases/FollowSlaveUseCase";
@injectable()
export default class FollowSlaveController {
- constructor(
- private usecase: FollowSlaveUseCase,
- ) {
- }
+ constructor(private usecase: FollowSlaveUseCase) {}
countTargets(m: messages.FollowRequestCountTargetsMessage): void {
this.usecase.countTargets(m.viewSize, m.framePosition);
diff --git a/src/content/controllers/KeymapController.ts b/src/content/controllers/KeymapController.ts
index 639b4a1..092e55c 100644
--- a/src/content/controllers/KeymapController.ts
+++ b/src/content/controllers/KeymapController.ts
@@ -1,15 +1,15 @@
-import { injectable, inject } from 'tsyringe';
-import * as operations from '../../shared/operations';
-import KeymapUseCase from '../usecases/KeymapUseCase';
-import AddonEnabledUseCase from '../usecases/AddonEnabledUseCase';
-import FindSlaveUseCase from '../usecases/FindSlaveUseCase';
-import ScrollUseCase from '../usecases/ScrollUseCase';
-import FocusUseCase from '../usecases/FocusUseCase';
-import ClipboardUseCase from '../usecases/ClipboardUseCase';
-import OperationClient from '../client/OperationClient';
-import MarkKeyyUseCase from '../usecases/MarkKeyUseCase';
-import FollowMasterClient from '../client/FollowMasterClient';
-import Key from '../../shared/settings/Key';
+import { injectable, inject } from "tsyringe";
+import * as operations from "../../shared/operations";
+import KeymapUseCase from "../usecases/KeymapUseCase";
+import AddonEnabledUseCase from "../usecases/AddonEnabledUseCase";
+import FindSlaveUseCase from "../usecases/FindSlaveUseCase";
+import ScrollUseCase from "../usecases/ScrollUseCase";
+import FocusUseCase from "../usecases/FocusUseCase";
+import ClipboardUseCase from "../usecases/ClipboardUseCase";
+import OperationClient from "../client/OperationClient";
+import MarkKeyyUseCase from "../usecases/MarkKeyUseCase";
+import FollowMasterClient from "../client/FollowMasterClient";
+import Key from "../../shared/settings/Key";
@injectable()
export default class KeymapController {
@@ -22,13 +22,12 @@ export default class KeymapController {
private clipbaordUseCase: ClipboardUseCase,
private markKeyUseCase: MarkKeyyUseCase,
- @inject('OperationClient')
+ @inject("OperationClient")
private operationClient: OperationClient,
- @inject('FollowMasterClient')
- private followMasterClient: FollowMasterClient,
- ) {
- }
+ @inject("FollowMasterClient")
+ private followMasterClient: FollowMasterClient
+ ) {}
// eslint-disable-next-line complexity, max-lines-per-function
press(key: Key): boolean {
@@ -43,47 +42,46 @@ export default class KeymapController {
const doFunc = ((op: operations.Operation) => {
switch (op.type) {
- case operations.ADDON_ENABLE:
- return () => this.addonEnabledUseCase.enable();
- case operations.ADDON_DISABLE:
- return () => this.addonEnabledUseCase.disable();
- case operations.ADDON_TOGGLE_ENABLED:
- return () => this.addonEnabledUseCase.toggle();
- case operations.FIND_NEXT:
- return () => this.findSlaveUseCase.findNext();
- case operations.FIND_PREV:
- return () => this.findSlaveUseCase.findPrev();
- case operations.SCROLL_VERTICALLY:
- return () => this.scrollUseCase.scrollVertically(op.count);
- case operations.SCROLL_HORIZONALLY:
- return () => this.scrollUseCase.scrollHorizonally(op.count);
- case operations.SCROLL_PAGES:
- return () => this.scrollUseCase.scrollPages(op.count);
- case operations.SCROLL_TOP:
- return () => this.scrollUseCase.scrollToTop();
- case operations.SCROLL_BOTTOM:
- return () => this.scrollUseCase.scrollToBottom();
- case operations.SCROLL_HOME:
- return () => this.scrollUseCase.scrollToHome();
- case operations.SCROLL_END:
- return () => this.scrollUseCase.scrollToEnd();
- case operations.FOLLOW_START:
- return () => this.followMasterClient.startFollow(
- op.newTab, op.background);
- case operations.MARK_SET_PREFIX:
- return () => this.markKeyUseCase.enableSetMode();
- case operations.MARK_JUMP_PREFIX:
- return () => this.markKeyUseCase.enableJumpMode();
- case operations.FOCUS_INPUT:
- return () => this.focusUseCase.focusFirstInput();
- case operations.URLS_YANK:
- return () => this.clipbaordUseCase.yankCurrentURL();
- case operations.URLS_PASTE:
- return () => this.clipbaordUseCase.openOrSearch(
- op.newTab ? op.newTab : false,
- );
- default:
- return null;
+ case operations.ADDON_ENABLE:
+ return () => this.addonEnabledUseCase.enable();
+ case operations.ADDON_DISABLE:
+ return () => this.addonEnabledUseCase.disable();
+ case operations.ADDON_TOGGLE_ENABLED:
+ return () => this.addonEnabledUseCase.toggle();
+ case operations.FIND_NEXT:
+ return () => this.findSlaveUseCase.findNext();
+ case operations.FIND_PREV:
+ return () => this.findSlaveUseCase.findPrev();
+ case operations.SCROLL_VERTICALLY:
+ return () => this.scrollUseCase.scrollVertically(op.count);
+ case operations.SCROLL_HORIZONALLY:
+ return () => this.scrollUseCase.scrollHorizonally(op.count);
+ case operations.SCROLL_PAGES:
+ return () => this.scrollUseCase.scrollPages(op.count);
+ case operations.SCROLL_TOP:
+ return () => this.scrollUseCase.scrollToTop();
+ case operations.SCROLL_BOTTOM:
+ return () => this.scrollUseCase.scrollToBottom();
+ case operations.SCROLL_HOME:
+ return () => this.scrollUseCase.scrollToHome();
+ case operations.SCROLL_END:
+ return () => this.scrollUseCase.scrollToEnd();
+ case operations.FOLLOW_START:
+ return () =>
+ this.followMasterClient.startFollow(op.newTab, op.background);
+ case operations.MARK_SET_PREFIX:
+ return () => this.markKeyUseCase.enableSetMode();
+ case operations.MARK_JUMP_PREFIX:
+ return () => this.markKeyUseCase.enableJumpMode();
+ case operations.FOCUS_INPUT:
+ return () => this.focusUseCase.focusFirstInput();
+ case operations.URLS_YANK:
+ return () => this.clipbaordUseCase.yankCurrentURL();
+ case operations.URLS_PASTE:
+ return () =>
+ this.clipbaordUseCase.openOrSearch(op.newTab ? op.newTab : false);
+ default:
+ return null;
}
})(nextOp.op);
diff --git a/src/content/controllers/MarkController.ts b/src/content/controllers/MarkController.ts
index 5eb898a..05a0c75 100644
--- a/src/content/controllers/MarkController.ts
+++ b/src/content/controllers/MarkController.ts
@@ -1,13 +1,10 @@
-import { injectable } from 'tsyringe';
-import * as messages from '../../shared/messages';
-import MarkUseCase from '../usecases/MarkUseCase';
+import { injectable } from "tsyringe";
+import * as messages from "../../shared/messages";
+import MarkUseCase from "../usecases/MarkUseCase";
@injectable()
export default class MarkController {
- constructor(
- private markUseCase: MarkUseCase,
- ) {
- }
+ constructor(private markUseCase: MarkUseCase) {}
scrollTo(message: messages.TabScrollToMessage) {
this.markUseCase.scroll(message.x, message.y);
diff --git a/src/content/controllers/MarkKeyController.ts b/src/content/controllers/MarkKeyController.ts
index e7653ee..a011af1 100644
--- a/src/content/controllers/MarkKeyController.ts
+++ b/src/content/controllers/MarkKeyController.ts
@@ -1,15 +1,14 @@
-import { injectable } from 'tsyringe';
-import MarkUseCase from '../usecases/MarkUseCase';
-import MarkKeyyUseCase from '../usecases/MarkKeyUseCase';
-import Key from '../../shared/settings/Key';
+import { injectable } from "tsyringe";
+import MarkUseCase from "../usecases/MarkUseCase";
+import MarkKeyyUseCase from "../usecases/MarkKeyUseCase";
+import Key from "../../shared/settings/Key";
@injectable()
export default class MarkKeyController {
constructor(
private markUseCase: MarkUseCase,
- private markKeyUseCase: MarkKeyyUseCase,
- ) {
- }
+ private markKeyUseCase: MarkKeyyUseCase
+ ) {}
press(key: Key): boolean {
if (this.markKeyUseCase.isSetMode()) {
diff --git a/src/content/controllers/NavigateController.ts b/src/content/controllers/NavigateController.ts
index 3f2df7a..5b66a39 100644
--- a/src/content/controllers/NavigateController.ts
+++ b/src/content/controllers/NavigateController.ts
@@ -1,13 +1,10 @@
-import { injectable } from 'tsyringe';
-import { Message } from '../../shared/messages';
-import NavigateUseCase from '../usecases/NavigateUseCase';
+import { injectable } from "tsyringe";
+import { Message } from "../../shared/messages";
+import NavigateUseCase from "../usecases/NavigateUseCase";
@injectable()
export default class NavigateController {
- constructor(
- private navigateUseCase: NavigateUseCase,
- ) {
- }
+ constructor(private navigateUseCase: NavigateUseCase) {}
openHistoryNext(_m: Message): Promise<void> {
this.navigateUseCase.openHistoryNext();
diff --git a/src/content/controllers/SettingController.ts b/src/content/controllers/SettingController.ts
index 2d32c09..72d484c 100644
--- a/src/content/controllers/SettingController.ts
+++ b/src/content/controllers/SettingController.ts
@@ -1,16 +1,14 @@
-import { injectable } from 'tsyringe';
-import AddonEnabledUseCase from '../usecases/AddonEnabledUseCase';
-import SettingUseCase from '../usecases/SettingUseCase';
-import * as messages from '../../shared/messages';
+import { injectable } from "tsyringe";
+import AddonEnabledUseCase from "../usecases/AddonEnabledUseCase";
+import SettingUseCase from "../usecases/SettingUseCase";
+import * as messages from "../../shared/messages";
@injectable()
export default class SettingController {
-
constructor(
private addonEnabledUseCase: AddonEnabledUseCase,
- private settingUseCase: SettingUseCase,
- ) {
- }
+ private settingUseCase: SettingUseCase
+ ) {}
async initSettings(): Promise<void> {
try {