Make the background script Chromium compatible.

This commit is contained in:
Bauke 2022-03-23 14:07:08 +01:00
parent 16b017013a
commit 4a24828c32
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 8 additions and 2 deletions

View File

@ -2,9 +2,15 @@ import browser from 'webextension-polyfill';
import Bang, {BangParameters} from '../bang/bang.js'; import Bang, {BangParameters} from '../bang/bang.js';
browser.browserAction.onClicked.addListener(async () => { async function browserActionClicked() {
await browser.runtime.openOptionsPage(); await browser.runtime.openOptionsPage();
}); }
if (import.meta.env.VITE_BROWSER === 'chromium') {
browser.action.onClicked.addListener(browserActionClicked);
} else {
browser.browserAction.onClicked.addListener(browserActionClicked);
}
browser.runtime.onInstalled.addListener(async () => { browser.runtime.onInstalled.addListener(async () => {
if (import.meta.env.DEV) { if (import.meta.env.DEV) {