diff options
Diffstat (limited to 'src/content/actions')
-rw-r--r-- | src/content/actions/addon.js | 15 | ||||
-rw-r--r-- | src/content/actions/index.js | 4 | ||||
-rw-r--r-- | src/content/actions/input.js | 11 | ||||
-rw-r--r-- | src/content/actions/operation.js | 7 |
4 files changed, 28 insertions, 9 deletions
diff --git a/src/content/actions/addon.js b/src/content/actions/addon.js new file mode 100644 index 0000000..8d38025 --- /dev/null +++ b/src/content/actions/addon.js @@ -0,0 +1,15 @@ +import actions from 'content/actions'; + +const enable = () => { + return { type: actions.ADDON_ENABLE }; +}; + +const disable = () => { + return { type: actions.ADDON_DISABLE }; +}; + +const toggleEnabled = () => { + return { type: actions.ADDON_TOGGLE_ENABLED }; +}; + +export { enable, disable, toggleEnabled }; diff --git a/src/content/actions/index.js b/src/content/actions/index.js index f8db948..085d510 100644 --- a/src/content/actions/index.js +++ b/src/content/actions/index.js @@ -1,5 +1,9 @@ export default { // User input + ADDON_ENABLE: 'addon.enable', + ADDON_DISABLE: 'addon.disable', + ADDON_TOGGLE_ENABLED: 'addon.toggle.enabled', + INPUT_KEY_PRESS: 'input.key,press', INPUT_CLEAR_KEYS: 'input.clear.keys', INPUT_SET_KEYMAPS: 'input.set.keymaps', diff --git a/src/content/actions/input.js b/src/content/actions/input.js index 10ff835..31cfee3 100644 --- a/src/content/actions/input.js +++ b/src/content/actions/input.js @@ -1,16 +1,9 @@ import actions from 'content/actions'; -const asKeymapChars = (key, ctrl) => { - if (ctrl) { - return '<C-' + key.toUpperCase() + '>'; - } - return key; -}; - -const keyPress = (key, ctrl) => { +const keyPress = (key) => { return { type: actions.INPUT_KEY_PRESS, - key: asKeymapChars(key, ctrl), + key, }; }; diff --git a/src/content/actions/operation.js b/src/content/actions/operation.js index 81bcc2f..897f361 100644 --- a/src/content/actions/operation.js +++ b/src/content/actions/operation.js @@ -4,9 +4,16 @@ import * as scrolls from 'content/scrolls'; import * as navigates from 'content/navigates'; import * as urls from 'content/urls'; import * as consoleFrames from 'content/console-frames'; +import * as addonActions from './addon'; const exec = (operation) => { switch (operation.type) { + case operations.ADDON_ENABLE: + return addonActions.enable(); + case operations.ADDON_DISABLE: + return addonActions.disable(); + case operations.ADDON_TOGGLE_ENABLED: + return addonActions.toggleEnabled(); case operations.SCROLL_VERTICALLY: return scrolls.scrollVertically(window, operation.count); case operations.SCROLL_HORIZONALLY: |