diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-05-06 16:11:40 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-05-06 16:35:48 +0900 |
commit | 2c366ac3b1d7114869567845c955238e96056565 (patch) | |
tree | d98e96b4ee70c410ca1f84784013dc6a17bce3dd /src/background/shared | |
parent | 98bc2326eeeb5d915706dee9aadc2ac3e9af1789 (diff) |
Previous selected tab as redux
Diffstat (limited to 'src/background/shared')
-rw-r--r-- | src/background/shared/tabs.js | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/background/shared/tabs.js b/src/background/shared/tabs.js index 277afb2..f1dcc73 100644 --- a/src/background/shared/tabs.js +++ b/src/background/shared/tabs.js @@ -1,13 +1,3 @@ -let prevSelTab = 1; -let currSelTab = 1; - -browser.tabs.onActivated.addListener((activeInfo) => { - return browser.tabs.query({ currentWindow: true }).then(() => { - prevSelTab = currSelTab; - currSelTab = activeInfo.tabId; - }); -}); - const closeTab = (id) => { return browser.tabs.get(id).then((tab) => { if (!tab.pinned) { @@ -102,8 +92,8 @@ const selectLastTab = () => { }); }; -const selectPrevSelTab = () => { - return browser.tabs.update(prevSelTab, { active: true }); +const selectTab = (id) => { + return browser.tabs.update(id, { active: true }); }; const reload = (current, cache) => { @@ -131,6 +121,6 @@ const duplicate = (id) => { export { closeTab, closeTabForce, reopenTab, selectAt, selectByKeyword, selectPrevTab, selectNextTab, selectFirstTab, - selectLastTab, selectPrevSelTab, reload, updateTabPinned, + selectLastTab, selectTab, reload, updateTabPinned, toggleTabPinned, duplicate }; |