diff options
author | Daniel Campoverde <alx@sillybytes.net> | 2017-10-29 22:26:08 -0500 |
---|---|---|
committer | Daniel Campoverde <alx@sillybytes.net> | 2017-10-29 22:26:08 -0500 |
commit | ef98e196abb21f3ebcb884ca623fddf520f18e70 (patch) | |
tree | 0427753b7fd9719975079a7562ebb367fa352523 /src/background | |
parent | d0df1a05a17fd3b30eba215b0f163042878a56b2 (diff) |
Add TAB_LAST operation
Diffstat (limited to 'src/background')
-rw-r--r-- | src/background/actions/operation.js | 2 | ||||
-rw-r--r-- | src/background/tabs.js | 15 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/background/actions/operation.js b/src/background/actions/operation.js index 074157b..a5094c0 100644 --- a/src/background/actions/operation.js +++ b/src/background/actions/operation.js @@ -22,6 +22,8 @@ const exec = (operation, tab) => { return tabs.selectNextTab(tab.index, operation.count); case operations.TAB_FIRST: return tabs.selectFirstTab(); + case operations.TAB_LAST: + return tabs.selectLastTab(); 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 0567e68..020c826 100644 --- a/src/background/tabs.js +++ b/src/background/tabs.js @@ -86,13 +86,12 @@ const selectFirstTab = () => { }); }; -// const selectLastTab = (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 selectLastTab = () => { + return browser.tabs.query({ currentWindow: true }).then((tabs) => { + let id = tabs[tabs.length - 1].id; + return browser.tabs.update(id, { active: true }); + }); +}; const reload = (current, cache) => { return browser.tabs.reload( @@ -103,5 +102,5 @@ const reload = (current, cache) => { export { closeTab, reopenTab, selectAt, selectByKeyword, getCompletions, - selectPrevTab, selectNextTab, selectFirstTab, reload + selectPrevTab, selectNextTab, selectFirstTab, selectLastTab, reload }; |