aboutsummaryrefslogtreecommitdiff
path: root/src/content/reducers/input.js
blob: 23e7dd2716beee8076f4fe82e038c1bc5dee3949 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
  }
}