diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-25 21:55:45 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-25 22:16:49 +0900 |
commit | 48e005dc825a5211b4d3e92ed06ad15e01c23d13 (patch) | |
tree | 255ffc7841f33292a00f5bf0e11e4c4c854fe975 /src/background/usecases/TabUseCase.ts | |
parent | a2ee6897bfbb95a0cca50ab11042aaf94c5de77c (diff) |
Repeat open, tabopen and winopen command
Diffstat (limited to 'src/background/usecases/TabUseCase.ts')
-rw-r--r-- | src/background/usecases/TabUseCase.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/background/usecases/TabUseCase.ts b/src/background/usecases/TabUseCase.ts index 0239a87..31112a9 100644 --- a/src/background/usecases/TabUseCase.ts +++ b/src/background/usecases/TabUseCase.ts @@ -1,11 +1,13 @@ import { injectable } from 'tsyringe'; import TabPresenter from '../presenters/TabPresenter'; +import WindowPresenter from '../presenters/WindowPresenter'; import BrowserSettingRepository from '../repositories/BrowserSettingRepository'; @injectable() export default class TabUseCase { constructor( private tabPresenter: TabPresenter, + private windowPresenter: WindowPresenter, private browserSettingRepository: BrowserSettingRepository, ) { } @@ -77,4 +79,17 @@ export default class TabUseCase { this.tabPresenter.create(url); } } + + async openURL( + url: string, newTab?: boolean, newWindow?: boolean, + ): Promise<void> { + if (newWindow) { + await this.windowPresenter.create(url); + } else if (newTab) { + await this.tabPresenter.create(url); + } else { + let tab = await this.tabPresenter.getCurrent(); + await this.tabPresenter.open(url, tab.id); + } + } } |