diff options
Diffstat (limited to 'src/content/controllers')
-rw-r--r-- | src/content/controllers/KeymapController.ts | 26 | ||||
-rw-r--r-- | src/content/controllers/NavigateController.ts | 31 |
2 files changed, 35 insertions, 22 deletions
diff --git a/src/content/controllers/KeymapController.ts b/src/content/controllers/KeymapController.ts index 1835546..fcfaff1 100644 --- a/src/content/controllers/KeymapController.ts +++ b/src/content/controllers/KeymapController.ts @@ -4,10 +4,9 @@ import KeymapUseCase from '../usecases/KeymapUseCase'; import AddonEnabledUseCase from '../usecases/AddonEnabledUseCase'; import FindSlaveUseCase from '../usecases/FindSlaveUseCase'; import ScrollUseCase from '../usecases/ScrollUseCase'; -import NavigateUseCase from '../usecases/NavigateUseCase'; import FocusUseCase from '../usecases/FocusUseCase'; import ClipboardUseCase from '../usecases/ClipboardUseCase'; -import BackgroundClient from '../client/BackgroundClient'; +import OperationClient from '../client/OperationClient'; import MarkKeyyUseCase from '../usecases/MarkKeyUseCase'; import FollowMasterClient from '../client/FollowMasterClient'; import Key from '../domains/Key'; @@ -19,12 +18,13 @@ export default class KeymapController { private addonEnabledUseCase: AddonEnabledUseCase, private findSlaveUseCase: FindSlaveUseCase, private scrollUseCase: ScrollUseCase, - private navigateUseCase: NavigateUseCase, private focusUseCase: FocusUseCase, private clipbaordUseCase: ClipboardUseCase, - private backgroundClient: BackgroundClient, private markKeyUseCase: MarkKeyyUseCase, + @inject('OperationClient') + private backgroundClient: OperationClient, + @inject('FollowMasterClient') private followMasterClient: FollowMasterClient, ) { @@ -84,24 +84,6 @@ export default class KeymapController { case operations.MARK_JUMP_PREFIX: this.markKeyUseCase.enableJumpMode(); break; - case operations.NAVIGATE_HISTORY_PREV: - this.navigateUseCase.openHistoryPrev(); - break; - case operations.NAVIGATE_HISTORY_NEXT: - this.navigateUseCase.openHistoryNext(); - break; - case operations.NAVIGATE_LINK_PREV: - this.navigateUseCase.openLinkPrev(); - break; - case operations.NAVIGATE_LINK_NEXT: - this.navigateUseCase.openLinkNext(); - break; - case operations.NAVIGATE_PARENT: - this.navigateUseCase.openParent(); - break; - case operations.NAVIGATE_ROOT: - this.navigateUseCase.openRoot(); - break; case operations.FOCUS_INPUT: this.focusUseCase.focusFirstInput(); break; diff --git a/src/content/controllers/NavigateController.ts b/src/content/controllers/NavigateController.ts new file mode 100644 index 0000000..3f2df7a --- /dev/null +++ b/src/content/controllers/NavigateController.ts @@ -0,0 +1,31 @@ +import { injectable } from 'tsyringe'; +import { Message } from '../../shared/messages'; +import NavigateUseCase from '../usecases/NavigateUseCase'; + +@injectable() +export default class NavigateController { + constructor( + private navigateUseCase: NavigateUseCase, + ) { + } + + openHistoryNext(_m: Message): Promise<void> { + this.navigateUseCase.openHistoryNext(); + return Promise.resolve(); + } + + openHistoryPrev(_m: Message): Promise<void> { + this.navigateUseCase.openHistoryPrev(); + return Promise.resolve(); + } + + openLinkNext(_m: Message): Promise<void> { + this.navigateUseCase.openLinkNext(); + return Promise.resolve(); + } + + openLinkPrev(_m: Message): Promise<void> { + this.navigateUseCase.openLinkPrev(); + return Promise.resolve(); + } +} |