aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Campoverde <alx@sillybytes.net>2017-11-26 12:38:27 -0500
committerDaniel Campoverde <alx@sillybytes.net>2017-11-26 12:39:09 -0500
commite9a7f679c4bf2aa786be4f6a8b44c7c62f464577 (patch)
treeba7b085965aeefe3489aec2d1f744f865200af7d
parent9c1bc5552a0b2ee5899bffeecc2af5eeeea9f78b (diff)
Keep current en previous tabs id
-rw-r--r--src/background/tabs.js22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/background/tabs.js b/src/background/tabs.js
index 2bf780a..07083c5 100644
--- a/src/background/tabs.js
+++ b/src/background/tabs.js
@@ -1,4 +1,5 @@
let prevSelTab = 0;
+let currSelTab = 2;
const closeTab = (id) => {
return browser.tabs.remove(id);
@@ -111,14 +112,21 @@ const selectLastTab = () => {
});
};
+// const selectPrevSelTab = () => {
+// let tmpPrevSelTab = null;
+// return browser.tabs.query({ currentWindow: true, active: true }).then(
+// (tabs) => {
+// tmpPrevSelTab = tabs[0].id;
+// browser.tabs.update(prevSelTab, { active: true });
+// prevSelTab = tmpPrevSelTab;
+// });
+// };
+
const selectPrevSelTab = () => {
- let tmpPrevSelTab = null;
- return browser.tabs.query({ currentWindow: true, active: true }).then(
- (tabs) => {
- tmpPrevSelTab = tabs[0].id;
- browser.tabs.update(prevSelTab, { active: true });
- prevSelTab = tmpPrevSelTab;
- });
+ let tmpPrevSelTab = prevSelTab;
+ prevSelTab = currSelTab;
+ currSelTab = tmpPrevSelTab;
+ return browser.tabs.update(currSelTab, { active: true });
};
const reload = (current, cache) => {