blob: 35b9075a0ee2179fb0864fe937f0a9b789cedaaa (
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 * as keyUtils from '../../shared/utils/keys';
export interface State {
keys: keyUtils.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;
}
}
|