diff options
Diffstat (limited to 'src/background/usecases/link.js')
-rw-r--r-- | src/background/usecases/link.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/background/usecases/link.js b/src/background/usecases/link.js new file mode 100644 index 0000000..1339fdf --- /dev/null +++ b/src/background/usecases/link.js @@ -0,0 +1,26 @@ +import SettingRepository from '../repositories/setting'; +import TabPresenter from '../presenters/tab'; + +export default class LinkInteractor { + constructor() { + this.settingRepository = new SettingRepository(); + this.tabPresenter = new TabPresenter(); + } + + openToTab(url, tabId) { + return this.tabPresenter.open(url, tabId); + } + + async openNewTab(url, openerId, background) { + let settings = await this.settingRepository.get(); + let { adjacenttab } = settings.properties; + if (adjacenttab) { + return this.tabPresenter.create(url, { + openerTabId: openerId, active: !background + }); + } + return this.tabPresenter.create(url, { + openerTabId: openerId, active: !background + }); + } +} |