use globalThis instead of window to also work in service worker
This commit is contained in:
parent
f97b9a7538
commit
8202083710
|
@ -94,13 +94,13 @@ function startFetching() {
|
|||
});
|
||||
}
|
||||
|
||||
window.addEventListener('offline', async () => {
|
||||
globalThis.addEventListener('offline', async () => {
|
||||
browser.alarms.onAlarm.removeListener(handleAlarm);
|
||||
await browser.alarms.clear('fetchData');
|
||||
});
|
||||
window.addEventListener('online', () => {
|
||||
globalThis.addEventListener('online', () => {
|
||||
startFetching();
|
||||
});
|
||||
if (window.navigator.onLine) {
|
||||
if (globalThis.navigator.onLine) {
|
||||
startFetching();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue