diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-22 17:09:14 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-22 17:09:14 +0900 |
commit | 0846587baf8ff04d2183985a61f14ccdea7263d3 (patch) | |
tree | 828223c0aa96d1e7323d67fdda148aade5022f0f /src/background/presenters | |
parent | 42d902982a1d2edbca8ca2edb5fb25e642794e2a (diff) |
Open link as Clean Architecture
Diffstat (limited to 'src/background/presenters')
-rw-r--r-- | src/background/presenters/tab.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/background/presenters/tab.js b/src/background/presenters/tab.js index 6120f6e..66a207f 100644 --- a/src/background/presenters/tab.js +++ b/src/background/presenters/tab.js @@ -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) { |