diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-14 21:14:13 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-14 21:14:13 +0900 |
commit | c42ac8fac48f9d56b54af4818917082fda9af21e (patch) | |
tree | 5782600aa25482c2170101a29561cf08d1c2ae11 /src/background | |
parent | 9dc02b2fd8344facedfd7949899124c4d0722f68 (diff) |
improve store and reducers
Diffstat (limited to 'src/background')
-rw-r--r-- | src/background/index.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/background/index.js b/src/background/index.js index 0c3adce..e9757b9 100644 --- a/src/background/index.js +++ b/src/background/index.js @@ -2,12 +2,12 @@ import * as keys from './keys'; import * as inputActions from '../actions/input'; import * as operationActions from '../actions/operation'; import backgroundReducers from '../reducers/background'; +import reducers from '../reducers'; import commandReducer from '../reducers/command'; import inputReducers from '../reducers/input'; import * as store from '../store' -const emptyReducer = (state) => state; -const emptyStore = store.createStore(emptyReducer, (e) => { +const backgroundStore = store.createStore(reducers, (e) => { console.error('Vim-Vixen:', e); }); let inputState = inputReducers(undefined, {}); @@ -27,9 +27,7 @@ const keyQueueChanged = (sender, prevState, state) => { return Promise.resolve(); } let action = keys.defaultKeymap[matched]; - emptyStore.dispatch(operationActions.exec(action, sender), (e) => { - console.error('Vim-Vixen:', e); - }); + backgroundStore.dispatch(operationActions.exec(action, sender)); return handleMessage(inputActions.clearKeys(), sender).then(() => { return backgroundReducers(undefined, action, sender).then(() => { return browser.tabs.sendMessage(sender.tab.id, action); |