This repository has been archived on 2020-04-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Vim-Vixen/src/reducers/input.js
2017-10-03 20:58:50 +09:00

20 lines
412 B
JavaScript

import actions from '../actions';
const defaultState = {
keys: '',
};
export default function reducer(state = defaultState, action = {}) {
switch (action.type) {
case actions.INPUT_KEY_PRESS:
return Object.assign({}, state, {
keys: state.keys + action.key
});
case actions.INPUT_CLEAR_KEYS:
return Object.assign({}, state, {
keys: '',
});
default:
return state;
}
}