mirror of
https://github.com/XFox111/PasswordGeneratorExtension.git
synced 2026-04-22 08:08:01 +03:00
Major 4.0 (#380)
- Migrated to WXT - Migrated to NPM - Added Insert & copy action - Added ESLint
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
export default defineBackground(() => main());
|
||||
|
||||
async function main(): Promise<void>
|
||||
{
|
||||
await browser.contextMenus.removeAll();
|
||||
browser.contextMenus.onClicked.addListener(() => browser.action.openPopup());
|
||||
|
||||
const showMenu: boolean = (await storage.getItem<boolean>("sync:ContextMenu", { fallback: true }))!;
|
||||
updateMenus(showMenu);
|
||||
|
||||
storage.watch<boolean>("sync:ContextMenu", e => updateMenus(e!));
|
||||
}
|
||||
|
||||
async function updateMenus(showMenus: boolean): Promise<void>
|
||||
{
|
||||
await browser.contextMenus.removeAll();
|
||||
|
||||
if (showMenus)
|
||||
browser.contextMenus.create({
|
||||
id: "password-generator",
|
||||
title: i18n.t("manifest.name"),
|
||||
contexts: ["all"],
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user