Add background script to reload on load. Painful fix

This commit is contained in:
mrjvs
2024-01-31 18:55:22 +01:00
parent 3b88b136e8
commit e1fa034074

13
src/background.ts Normal file
View File

@@ -0,0 +1,13 @@
import { isChrome } from '~utils/extension';
// Both brave and firefox for some reason need this extension reload,
// If this isn't done, they will never load properly and will fail updateDynamicRules()
if (isChrome()) {
chrome.runtime.onStartup.addListener(() => {
chrome.runtime.reload();
});
} else {
browser.runtime.onStartup.addListener(() => {
browser.runtime.reload();
});
}