mirror of
https://github.com/LBRYFoundation/Watch-on-LBRY.git
synced 2025-08-23 17:47:26 +00:00
12 lines
515 B
JavaScript
12 lines
515 B
JavaScript
const func = () => {
|
|
chrome.storage.local.get(['enabled', 'redirect'], ({ enabled, redirect }) => {
|
|
if (enabled === null || enabled === undefined) enabled = true;
|
|
if (!redirect) redirect = 'lbry.tv';
|
|
chrome.storage.local.set({ enabled, redirect });
|
|
// have to set this manually as the trigger doesn't work for `onInstalled`
|
|
chrome.browserAction.setBadgeText({ text: enabled ? 'ON' : 'OFF' });
|
|
});
|
|
};
|
|
|
|
chrome.runtime.onStartup.addListener(func);
|
|
chrome.runtime.onInstalled.addListener(func);
|