aboutsummaryrefslogtreecommitdiff
path: root/src/content/actions/addon.ts
blob: 8dedae0e6dd432487dc309f8fc6fdcd8ab41e3ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import * as messages from '../../shared/messages';
import * as actions from './index';

const enable = (): Promise<actions.AddonAction> => setEnabled(true);

const disable = (): Promise<actions.AddonAction> => setEnabled(false);

const setEnabled = async(enabled: boolean): Promise<actions.AddonAction> => {
  await browser.runtime.sendMessage({
    type: messages.ADDON_ENABLED_RESPONSE,
    enabled,
  });
  return {
    type: actions.ADDON_SET_ENABLED,
    enabled,
  };
};

export { enable, disable, setEnabled };