From 4b9a890861b3501b7460bd88d8964c62c6b0bcb1 Mon Sep 17 00:00:00 2001 From: Bauke Date: Mon, 21 Mar 2022 10:43:24 +0100 Subject: [PATCH] Move ifs to the bottom. --- source/background-scripts/initialize.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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(); +}