Fix init bugs

This commit is contained in:
Sosthene 2025-12-03 10:43:44 +01:00
parent 77019896e5
commit 1025c907b5
4 changed files with 18 additions and 2 deletions

View File

@ -1,3 +1,9 @@
// Polyfill to prevent "chrome is not defined" errors
// Some dependencies may check for Chrome extension APIs without proper existence checks
if (typeof (globalThis as any).chrome === 'undefined') {
(globalThis as any).chrome = {};
}
import Services from './services/service';
import { Router } from './router/index';
import './components/header/Header';

View File

@ -148,7 +148,7 @@ export class Database {
if (this.serviceWorkerCheckIntervalId)
clearInterval(this.serviceWorkerCheckIntervalId);
this.serviceWorkerCheckIntervalId = window.setInterval(async () => {
this.serviceWorkerCheckIntervalId = setInterval(async () => {
const activeWorker =
this.serviceWorkerRegistration?.active ||
(await this.waitForServiceWorkerActivation(
@ -159,7 +159,7 @@ export class Database {
if (payload && payload.length != 0) {
activeWorker?.postMessage({ type: "SCAN", payload });
}
}, 5000);
}, 5000) as unknown as number;
} catch (error) {
console.error("[Database] Service Worker error:", error);
}

View File

@ -1,3 +1,8 @@
// Polyfill to prevent "chrome is not defined" errors in worker context
if (typeof (globalThis as any).chrome === 'undefined') {
(globalThis as any).chrome = {};
}
import * as Comlink from "comlink";
import {
ApiReturn,

View File

@ -1,3 +1,8 @@
// Polyfill to prevent "chrome is not defined" errors in worker context
if (typeof (globalThis as any).chrome === 'undefined') {
(globalThis as any).chrome = {};
}
import * as Comlink from 'comlink';
import { APP_CONFIG } from '../config/constants';