diff options
author | Daniel Campoverde <alx@sillybytes.net> | 2017-10-29 20:48:22 -0500 |
---|---|---|
committer | Daniel Campoverde <alx@sillybytes.net> | 2017-10-29 20:48:22 -0500 |
commit | a2651f617f2b1aebd8d12eb868fcbcd5303ed6ea (patch) | |
tree | 74ff9ff4593f4f5d8231750b21e1226e2ae7875a /src/background | |
parent | aeebdcd3ef10bc3a15b6bc000189e0b5774be0e9 (diff) |
Add TAB_FIRST operation
Diffstat (limited to 'src/background')
-rw-r--r-- | src/background/actions/operation.js | 2 | ||||
-rw-r--r-- | src/background/tabs.js | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/background/actions/operation.js b/src/background/actions/operation.js index b94c117..7c0df4e 100644 --- a/src/background/actions/operation.js +++ b/src/background/actions/operation.js @@ -20,6 +20,8 @@ const exec = (operation, tab) => { return tabs.selectPrevTab(tab.index, operation.count); case operations.TAB_NEXT: return tabs.selectNextTab(tab.index, operation.count); + case operations.TAB_FIRST: + return tabs.selectFirstTab(tab.index, operation.count); case operations.TAB_RELOAD: return tabs.reload(tab, operation.cache); case operations.ZOOM_IN: diff --git a/src/background/tabs.js b/src/background/tabs.js index eed3252..eaff0f6 100644 --- a/src/background/tabs.js +++ b/src/background/tabs.js @@ -79,6 +79,19 @@ const selectNextTab = (current, count) => { }); }; +const selectFirstTab = (current, count) => { + let id = tabs[0].id; + return browser.tabs.update(id, { active: true }); +}; + +// const selectFirstTab = (current, count) => { +// return browser.tabs.query({ currentWindow: true }).then((tabs) => { +// let select = tabs.length; +// let id = tabs[select].id; +// return browser.tabs.update(id, { active: true }); +// }); +// }; + const reload = (current, cache) => { return browser.tabs.reload( current.id, |