diff --git a/source/background-scripts/initialize.ts b/source/background-scripts/initialize.ts index 954f884..71fc975 100644 --- a/source/background-scripts/initialize.ts +++ b/source/background-scripts/initialize.ts @@ -16,22 +16,11 @@ browser.runtime.onStartup.addListener(async () => { await updateBadge(await Settings.fromSyncStorage()); }); -if (import.meta.env.VITE_BROWSER === 'chromium') { - browser.action.onClicked.addListener(actionClicked); -} else { - browser.browserAction.onClicked.addListener(browserActionClicked); - void initializeContextMenus(); -} - browser.runtime.onInstalled.addListener(async () => { await initializeContextMenus(); await updateBadge(await Settings.fromSyncStorage()); }); -if (import.meta.env.DEV) { - void browser.runtime.openOptionsPage(); -} - browser.contextMenus.onClicked.addListener(async (info, tab) => { const contextMenus = getContextMenus(); const contextMenuIds = new Set( @@ -40,3 +29,14 @@ browser.contextMenus.onClicked.addListener(async (info, tab) => { await contextClicked(contextMenuIds, info, tab); }); + +if (import.meta.env.DEV) { + void browser.runtime.openOptionsPage(); +} + +if (import.meta.env.VITE_BROWSER === 'chromium') { + browser.action.onClicked.addListener(actionClicked); +} else { + browser.browserAction.onClicked.addListener(browserActionClicked); + void initializeContextMenus(); +}