diff options
Diffstat (limited to 'src/background/actions/tab.js')
-rw-r--r-- | src/background/actions/tab.js | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/background/actions/tab.js b/src/background/actions/tab.js index 0d439fd..5cf1e8c 100644 --- a/src/background/actions/tab.js +++ b/src/background/actions/tab.js @@ -1,19 +1,20 @@ import actions from './index'; -const openNewTab = (url, openerTabId, background = false, adjacent = false) => { - if (adjacent) { - return browser.tabs.query({ - active: true, currentWindow: true - }).then((tabs) => { - return browser.tabs.create({ - url, - openerTabId, - active: !background, - index: tabs[0].index + 1 - }); - }); +const openNewTab = async( + url, openerTabId, background = false, adjacent = false +) => { + if (!adjacent) { + return browser.tabs.create({ url, active: !background }); } - return browser.tabs.create({ url, active: !background }); + let tabs = await browser.tabs.query({ + active: true, currentWindow: true + }); + return browser.tabs.create({ + url, + openerTabId, + active: !background, + index: tabs[0].index + 1 + }); }; const openToTab = (url, tab) => { |