parent
42d902982a
commit
0846587baf
5 changed files with 73 additions and 12 deletions
@ -0,0 +1,15 @@ |
||||
import LinkInteractor from '../usecases/link'; |
||||
|
||||
export default class LinkController { |
||||
constructor() { |
||||
this.linkInteractor = new LinkInteractor(); |
||||
} |
||||
|
||||
openToTab(url, tabId) { |
||||
this.linkInteractor.openToTab(url, tabId); |
||||
} |
||||
|
||||
openNewTab(url, openerId, background) { |
||||
this.linkInteractor.openNewTab(url, openerId, background); |
||||
} |
||||
} |
@ -0,0 +1,27 @@ |
||||
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) { |
||||
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 |
||||
}); |
||||
} |
||||
} |
Reference in new issue