Fix init bugs
This commit is contained in:
parent
77019896e5
commit
1025c907b5
@ -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 Services from './services/service';
|
||||||
import { Router } from './router/index';
|
import { Router } from './router/index';
|
||||||
import './components/header/Header';
|
import './components/header/Header';
|
||||||
|
|||||||
@ -148,7 +148,7 @@ export class Database {
|
|||||||
|
|
||||||
if (this.serviceWorkerCheckIntervalId)
|
if (this.serviceWorkerCheckIntervalId)
|
||||||
clearInterval(this.serviceWorkerCheckIntervalId);
|
clearInterval(this.serviceWorkerCheckIntervalId);
|
||||||
this.serviceWorkerCheckIntervalId = window.setInterval(async () => {
|
this.serviceWorkerCheckIntervalId = setInterval(async () => {
|
||||||
const activeWorker =
|
const activeWorker =
|
||||||
this.serviceWorkerRegistration?.active ||
|
this.serviceWorkerRegistration?.active ||
|
||||||
(await this.waitForServiceWorkerActivation(
|
(await this.waitForServiceWorkerActivation(
|
||||||
@ -159,7 +159,7 @@ export class Database {
|
|||||||
if (payload && payload.length != 0) {
|
if (payload && payload.length != 0) {
|
||||||
activeWorker?.postMessage({ type: "SCAN", payload });
|
activeWorker?.postMessage({ type: "SCAN", payload });
|
||||||
}
|
}
|
||||||
}, 5000);
|
}, 5000) as unknown as number;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("[Database] Service Worker error:", error);
|
console.error("[Database] Service Worker error:", error);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 * as Comlink from "comlink";
|
||||||
import {
|
import {
|
||||||
ApiReturn,
|
ApiReturn,
|
||||||
|
|||||||
@ -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 * as Comlink from 'comlink';
|
||||||
import { APP_CONFIG } from '../config/constants';
|
import { APP_CONFIG } from '../config/constants';
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user