2022-03-02 12:17:15 +00:00
|
|
|
import browser from 'webextension-polyfill';
|
|
|
|
|
2022-03-23 20:52:22 +00:00
|
|
|
async function browserActionClicked() {
|
2022-03-02 12:17:15 +00:00
|
|
|
await browser.runtime.openOptionsPage();
|
2022-03-23 20:52:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|