Add TAB_FIRST operation

This commit is contained in:
Daniel Campoverde 2017-10-29 20:48:22 -05:00
parent aeebdcd3ef
commit a2651f617f
3 changed files with 16 additions and 0 deletions

View file

@ -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:

View file

@ -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,

View file

@ -36,6 +36,7 @@ export default {
TAB_REOPEN: 'tabs.reopen',
TAB_PREV: 'tabs.prev',
TAB_NEXT: 'tabs.next',
TAB_FIRST: 'tabs.first',
TAB_RELOAD: 'tabs.reload',
// Zooms