aboutsummaryrefslogtreecommitdiff
path: root/src/background/actions/tab.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/background/actions/tab.js')
-rw-r--r--src/background/actions/tab.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/background/actions/tab.js b/src/background/actions/tab.js
index 40da55d..3c642fd 100644
--- a/src/background/actions/tab.js
+++ b/src/background/actions/tab.js
@@ -1,9 +1,21 @@
-const openNewTab = (url, openerTabId) => {
- return browser.tabs.create({ url, openerTabId });
+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
+ });
+ });
+ }
+ return browser.tabs.create({ url, active: !background });
};
const openToTab = (url, tab) => {
return browser.tabs.update(tab.id, { url: url });
};
-export { openToTab, openNewTab };
+export { openNewTab, openToTab };