Open link as Clean Architecture
This commit is contained in:
parent
42d902982a
commit
0846587baf
5 changed files with 73 additions and 12 deletions
|
@ -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) {
|
||||
|
|
Reference in a new issue