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/content/reducers/input.js
2018-06-28 20:44:57 +09:00

18 lines
385 B
JavaScript

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