blob: 800a8f05fd112d8c8c38ca8f159ebb60e09e404f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import * as actions from '../actions';
import Key from '../domains/Key';
export interface State {
keys: Key[],
}
const defaultState: State = {
keys: []
};
export default function reducer(
state: State = defaultState,
action: actions.InputAction,
): State {
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;
}
}
|