From 5a7db96febd4e3cb2aa519610da75e0bccd69a7f Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Thu, 23 May 2019 21:30:07 +0900 Subject: Move some navigation operations to background --- src/content/controllers/KeymapController.ts | 12 ----------- src/content/controllers/NavigateController.ts | 31 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 src/content/controllers/NavigateController.ts (limited to 'src/content/controllers') 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 { + this.navigateUseCase.openHistoryNext(); + return Promise.resolve(); + } + + openHistoryPrev(_m: Message): Promise { + this.navigateUseCase.openHistoryPrev(); + return Promise.resolve(); + } + + openLinkNext(_m: Message): Promise { + this.navigateUseCase.openLinkNext(); + return Promise.resolve(); + } + + openLinkPrev(_m: Message): Promise { + this.navigateUseCase.openLinkPrev(); + return Promise.resolve(); + } +} -- cgit v1.2.3