diff --git a/src/js/service-worker.js b/src/js/service-worker.js index 5ea8055..e7be12b 100644 --- a/src/js/service-worker.js +++ b/src/js/service-worker.js @@ -2,12 +2,29 @@ import { checkPerms, enableSite, requestPerms, toggleSite } from './export.js' +chrome.runtime.onStartup.addListener(onStartup) chrome.runtime.onInstalled.addListener(onInstalled) chrome.contextMenus.onClicked.addListener(onClicked) chrome.commands.onCommand.addListener(onCommand) chrome.runtime.onMessage.addListener(onMessage) chrome.storage.onChanged.addListener(onChanged) +/** + * On Startup Callback + * @function onStartup + */ +async function onStartup() { + console.log('onStartup') + if (typeof browser !== 'undefined') { + console.log('Firefox CTX Menu Workaround') + const { options } = await chrome.storage.sync.get(['options']) + console.debug('options:', options) + if (options.contextMenu) { + createContextMenus() + } + } +} + /** * Installed Callback * @function onInstalled