move background actions to operations
This commit is contained in:
parent
0ae39f1b67
commit
b6e5153c1f
6 changed files with 56 additions and 33 deletions
|
@ -1,9 +1,15 @@
|
|||
import * as keys from './keys';
|
||||
import * as inputActions from '../actions/input';
|
||||
import * as operationActions from '../actions/operation';
|
||||
import backgroundReducers from '../reducers/background';
|
||||
import commandReducer from '../reducers/command';
|
||||
import inputReducers from '../reducers/input';
|
||||
import * as store from '../store'
|
||||
|
||||
const emptyReducer = (state, action) => state;
|
||||
const emptyStore = store.createStore(emptyReducer, (e) => {
|
||||
console.error('Vim-Vixen:', e);
|
||||
});
|
||||
let inputState = inputReducers(undefined, {});
|
||||
|
||||
const keyQueueChanged = (sender, prevState, state) => {
|
||||
|
@ -21,6 +27,9 @@ 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);
|
||||
});
|
||||
return handleMessage(inputActions.clearKeys(), sender).then(() => {
|
||||
return backgroundReducers(undefined, action, sender).then(() => {
|
||||
return browser.tabs.sendMessage(sender.tab.id, action);
|
||||
|
|
Reference in a new issue