Minor fix
This commit is contained in:
parent
93a4fd17c7
commit
c1802c9c59
@ -1,6 +1,13 @@
|
|||||||
import Services from './service';
|
import Services from './service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database service managing IndexedDB operations via Web Worker and Service Worker
|
||||||
|
*/
|
||||||
export class Database {
|
export class Database {
|
||||||
|
// ============================================
|
||||||
|
// PRIVATE PROPERTIES
|
||||||
|
// ============================================
|
||||||
|
|
||||||
private static instance: Database;
|
private static instance: Database;
|
||||||
private serviceWorkerRegistration: ServiceWorkerRegistration | null = null;
|
private serviceWorkerRegistration: ServiceWorkerRegistration | null = null;
|
||||||
private serviceWorkerCheckIntervalId: number | null = null;
|
private serviceWorkerCheckIntervalId: number | null = null;
|
||||||
@ -155,13 +162,11 @@ export class Database {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async checkForUpdates() {
|
private async checkForUpdates(): Promise<void> {
|
||||||
if (this.serviceWorkerRegistration) {
|
if (this.serviceWorkerRegistration) {
|
||||||
// Check for updates to the service worker
|
|
||||||
try {
|
try {
|
||||||
await this.serviceWorkerRegistration.update();
|
await this.serviceWorkerRegistration.update();
|
||||||
|
|
||||||
// If there's a new worker waiting, activate it immediately
|
|
||||||
if (this.serviceWorkerRegistration.waiting) {
|
if (this.serviceWorkerRegistration.waiting) {
|
||||||
this.serviceWorkerRegistration.waiting.postMessage({ type: 'SKIP_WAITING' });
|
this.serviceWorkerRegistration.waiting.postMessage({ type: 'SKIP_WAITING' });
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user