aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/Application.ts10
-rw-r--r--src/content/controllers/KeymapController.ts12
-rw-r--r--src/content/controllers/NavigateController.ts31
3 files changed, 41 insertions, 12 deletions
diff --git a/src/content/Application.ts b/src/content/Application.ts
index 470bf53..1677655 100644
--- a/src/content/Application.ts
+++ b/src/content/Application.ts
@@ -12,6 +12,7 @@ import MarkKeyController from './controllers/MarkKeyController';
import AddonEnabledController from './controllers/AddonEnabledController';
import SettingController from './controllers/SettingController';
import ConsoleFrameController from './controllers/ConsoleFrameController';
+import NavigateController from './controllers/NavigateController';
import * as messages from '../shared/messages';
type Message = messages.Message;
@@ -33,6 +34,7 @@ export default class Application {
private addonEnabledController: AddonEnabledController,
private settingController: SettingController,
private consoleFrameController: ConsoleFrameController,
+ private navigateController: NavigateController,
) {
}
@@ -98,6 +100,14 @@ export default class Application {
return this.settingController.reloadSettings(msg);
case messages.ADDON_TOGGLE_ENABLED:
return this.addonEnabledUseCase.toggle();
+ case messages.NAVIGATE_HISTORY_NEXT:
+ return this.navigateController.openHistoryNext(msg);
+ case messages.NAVIGATE_HISTORY_PREV:
+ return this.navigateController.openHistoryPrev(msg);
+ case messages.NAVIGATE_LINK_NEXT:
+ return this.navigateController.openLinkNext(msg);
+ case messages.NAVIGATE_LINK_PREV:
+ return this.navigateController.openLinkPrev(msg);
}
});
diff --git a/src/content/controllers/KeymapController.ts b/src/content/controllers/KeymapController.ts
index 1835546..4be8f9d 100644
--- a/src/content/controllers/KeymapController.ts
+++ b/src/content/controllers/KeymapController.ts
@@ -84,18 +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;
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();
+ }
+}