use input as store/reducer

This commit is contained in:
Shin'ya Ueoka 2017-09-14 21:40:28 +09:00
parent c42ac8fac4
commit 6127fdc285
5 changed files with 44 additions and 37 deletions

View file

@ -2,18 +2,18 @@ import operations from '../operations';
import * as tabs from '../background/tabs';
import * as zooms from '../background/zooms';
export function exec(operation, sender) {
export function exec(operation, tab) {
switch (operation.type) {
case operations.TABS_CLOSE:
return tabs.closeTab(sender.tab.id);
return tabs.closeTab(tab.id);
case operations.TABS_REOPEN:
return tabs.reopenTab();
case operations.TABS_PREV:
return tabs.selectPrevTab(sender.tab.index, operation.count);
return tabs.selectPrevTab(tab.index, operation.count);
case operations.TABS_NEXT:
return tabs.selectNextTab(sender.tab.index, operation.count);
return tabs.selectNextTab(tab.index, operation.count);
case operations.TABS_RELOAD:
return tabs.reload(sender.tab, operation.cache);
return tabs.reload(tab, operation.cache);
case operations.ZOOM_IN:
return zooms.zoomIn();
case operations.ZOOM_OUT:
@ -21,7 +21,7 @@ export function exec(operation, sender) {
case operations.ZOOM_NEUTRAL:
return zooms.neutral();
default:
return browser.tabs.sendMessage(sender.tab.id, {
return browser.tabs.sendMessage(tab.id, {
type: 'require.content.operation',
operation
});