1
Fork 0
webextension-template/source/background-scripts/initialize.ts

20 lines
525 B
TypeScript
Raw Normal View History

2022-03-02 12:17:15 +00:00
import browser from 'webextension-polyfill';
async function browserActionClicked() {
2022-03-02 12:17:15 +00:00
await browser.runtime.openOptionsPage();
}
if (import.meta.env.VITE_BROWSER === 'chromium') {
browser.action.onClicked.addListener(browserActionClicked);
} else {
browser.browserAction.onClicked.addListener(browserActionClicked);
}
2022-03-02 12:17:15 +00:00
browser.runtime.onInstalled.addListener(async () => {
console.debug('WebExtension Template has been installed!');
if (import.meta.env.DEV) {
await browser.runtime.openOptionsPage();
}
});