key input sequence as action/reducer

This commit is contained in:
Shin'ya Ueoka 2017-09-10 21:28:00 +09:00
parent adc6a5175c
commit 879b5afe66
9 changed files with 135 additions and 127 deletions

View file

@ -29,4 +29,8 @@ export default {
FOLLOW_START: 'follow.start',
HISTORY_PREV: 'history.prev',
HISTORY_NEXT: 'history.next',
// User input
INPUT_KEY_PRESS: 'input.key,press',
INPUT_CLEAR_KEYS: 'input.clear.keys',
};

15
src/actions/input.js Normal file
View file

@ -0,0 +1,15 @@
import actions from '../actions';
export function keyPress(code, ctrl) {
return {
type: actions.INPUT_KEY_PRESS,
code,
ctrl
};
}
export function clearKeys() {
return {
type: actions.INPUT_CLEAR_KEYS
}
}