diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-08 21:20:49 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-08 21:20:49 +0900 |
commit | 37840c2abb02948d36cdcfaab9063f3ea67fdb6b (patch) | |
tree | 2662c396dea1761f57ed508616d2c76389aba5f9 /src/content/actions/addon.js | |
parent | 9f64b19bef06328999a5ed602ba89867402b9d5c (diff) | |
parent | 43beccfe0f323e2363fe97bdb6bc0d71558fda47 (diff) |
Merge pull request #429 from ueokande/use-official-redux
Use official redux
Diffstat (limited to 'src/content/actions/addon.js')
-rw-r--r-- | src/content/actions/addon.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/content/actions/addon.js b/src/content/actions/addon.js index 8d38025..b30cf16 100644 --- a/src/content/actions/addon.js +++ b/src/content/actions/addon.js @@ -1,15 +1,19 @@ +import messages from 'shared/messages'; import actions from 'content/actions'; -const enable = () => { - return { type: actions.ADDON_ENABLE }; -}; +const enable = () => setEnabled(true); -const disable = () => { - return { type: actions.ADDON_DISABLE }; -}; +const disable = () => setEnabled(false); -const toggleEnabled = () => { - return { type: actions.ADDON_TOGGLE_ENABLED }; +const setEnabled = async(enabled) => { + await browser.runtime.sendMessage({ + type: messages.ADDON_ENABLED_RESPONSE, + enabled, + }); + return { + type: actions.ADDON_SET_ENABLED, + enabled, + }; }; -export { enable, disable, toggleEnabled }; +export { enable, disable, setEnabled }; |