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/actions/input.js
2017-10-09 14:30:58 +09:00

30 lines
512 B
JavaScript

import actions from 'content/actions';
const asKeymapChars = (key, ctrl) => {
if (ctrl) {
return '<C-' + key.toUpperCase() + '>';
}
return key;
};
const keyPress = (key, ctrl) => {
return {
type: actions.INPUT_KEY_PRESS,
key: asKeymapChars(key, ctrl),
};
};
const clearKeys = () => {
return {
type: actions.INPUT_CLEAR_KEYS
};
};
const setKeymaps = (keymaps) => {
return {
type: actions.INPUT_SET_KEYMAPS,
keymaps,
};
};
export { keyPress, clearKeys, setKeymaps };