Watch-on-LBRY/scripts/runtimeOnInstalled.js
Yamboy1 464150afac See commit desc.
Big changes here.
- I've moved all of the scripts to individual
files in the `scripts` folder.
- I've updated all the code to ES7.
- The extension stores the state in browser
storage now, and it persists.
- The extension has a default state of on.
2020-01-11 23:07:55 +13:00

8 lines
376 B
JavaScript

chrome.runtime.onInstalled.addListener(() => {
chrome.storage.local.get('enabled', ({ enabled }) => {
if (enabled === null || enabled === undefined) enabled = true;
chrome.storage.local.set({ enabled });
// have to set this manually as the trigger doesn't work for `onInstalled`
chrome.browserAction.setBadgeText({ text: enabled ? "ON" : "OFF" });
});
});