diff options
Diffstat (limited to 'src/background/usecases')
-rw-r--r-- | src/background/usecases/NavigateUseCase.ts | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/background/usecases/NavigateUseCase.ts b/src/background/usecases/NavigateUseCase.ts new file mode 100644 index 0000000..76e1c8e --- /dev/null +++ b/src/background/usecases/NavigateUseCase.ts @@ -0,0 +1,40 @@ +import { injectable } from 'tsyringe'; +import NavigateClient from '../clients/NavigateClient'; +import TabPresenter from '../presenters/TabPresenter'; + +@injectable() +export default class NavigateUseCase { + constructor( + private tabPresenter: TabPresenter, + private navigateClient: NavigateClient, + ) { + } + + async openHistoryNext(): Promise<void> { + let tab = await this.tabPresenter.getCurrent(); + await this.navigateClient.historyNext(tab.id!!); + } + + async openHistoryPrev(): Promise<void> { + let tab = await this.tabPresenter.getCurrent(); + await this.navigateClient.historyPrev(tab.id!!); + } + + async openLinkNext(): Promise<void> { + let tab = await this.tabPresenter.getCurrent(); + await this.navigateClient.linkNext(tab.id!!); + } + + async openLinkPrev(): Promise<void> { + let tab = await this.tabPresenter.getCurrent(); + await this.navigateClient.linkPrev(tab.id!!); + } + + openParent(): Promise<void> { + throw new Error('not implemented'); + } + + openRoot(): Promise<void> { + throw new Error('not implemented'); + } +} |