Open link as Clean Architecture

This commit is contained in:
Shin'ya Ueoka 2018-07-22 17:09:14 +09:00
parent 42d902982a
commit 0846587baf
5 changed files with 73 additions and 12 deletions

View file

@ -1,6 +1,22 @@
export default class TabPresenter {
create(url) {
browser.tabs.create({ url, });
open(url, tabId) {
return browser.tabs.update(tabId, { url });
}
create(url, { openerTabId, active }) {
return browser.tabs.create({ url, openerTabId, active });
}
async createAdjacent(url, { openerTabId, active }) {
let tabs = await browser.tabs.query({
active: true, currentWindow: true
});
return browser.tabs.create({
url,
openerTabId,
active,
index: tabs[0].index + 1
});
}
onSelected(listener) {