Skip to content

fixed menu adding #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function addMenuItemProcessFolder() {
});
}

async function load() {
async function onInstalled() {
const {
catchAllBirdHideWelcomeMessage: hideWelcomeMessage
} = await messenger.storage.local.get({
Expand All @@ -50,10 +50,16 @@ async function load() {
await welcomeTab();
}

await messenger.menus.removeAll();

await addMenuItemProcessInbox();
await addMenuItemProcessFolder();
};

// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus#creating_menu_items
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onInstalled
messenger.runtime.onInstalled.addListener(onInstalled);

// listener creation has to be on top level to work with manifest v3
// https://developer.chrome.com/docs/extensions/develop/migrate/to-service-workers#register-listeners

Expand All @@ -79,5 +85,3 @@ messenger.menus.onClicked.addListener(async (info, tab) => {
await processInbox();
}
});

document.addEventListener("DOMContentLoaded", load);
Loading