Fix Db initialisation issue
This commit is contained in:
parent
62c8d95ea3
commit
bcf405e3c5
@ -72,9 +72,11 @@ class Database {
|
|||||||
};
|
};
|
||||||
|
|
||||||
request.onsuccess = () => {
|
request.onsuccess = () => {
|
||||||
this.db = request.result;
|
setTimeout(() => {
|
||||||
this.initServiceWorker();
|
this.db = request.result;
|
||||||
resolve();
|
this.initServiceWorker();
|
||||||
|
resolve();
|
||||||
|
}, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
request.onerror = () => {
|
request.onerror = () => {
|
||||||
@ -111,9 +113,8 @@ class Database {
|
|||||||
const registration = await navigator.serviceWorker.register('/src/service-workers/database.worker.js', { type: 'module' });
|
const registration = await navigator.serviceWorker.register('/src/service-workers/database.worker.js', { type: 'module' });
|
||||||
console.log('Service Worker registered with scope:', registration.scope);
|
console.log('Service Worker registered with scope:', registration.scope);
|
||||||
|
|
||||||
this.serviceWorkerRegistration = registration;
|
this.serviceWorkerRegistration = registration
|
||||||
|
await this.checkForUpdates();
|
||||||
this.checkForUpdates();
|
|
||||||
|
|
||||||
// Set up the message channels
|
// Set up the message channels
|
||||||
this.messageChannel.port1.onmessage = this.handleAddObjectResponse;
|
this.messageChannel.port1.onmessage = this.handleAddObjectResponse;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user