aboutsummaryrefslogtreecommitdiff
path: root/src/content/actions/addon.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/actions/addon.js')
-rw-r--r--src/content/actions/addon.js22
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 };