@live-change/db-store-indexeddb 0.6.3 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/Store.js +6 -2
  2. package/package.json +3 -3
package/lib/Store.js CHANGED
@@ -350,7 +350,7 @@ class Store {
350
350
  }
351
351
 
352
352
  async openDb() {
353
- //console.log("Opening db", this.dbName, this.storeName)
353
+ console.log("Opening db", this.dbName, this.storeName)
354
354
  const openRequest = globalThis.indexedDB.open(this.idbName, 1)
355
355
  globalThis.lastOpenRequest = openRequest
356
356
  this.dbPromise = handleRequest(openRequest, (event) => {
@@ -359,7 +359,11 @@ class Store {
359
359
  const store = db.createObjectStore(this.storeName, { keyPath: 'id' })
360
360
  })
361
361
  this.db = await this.dbPromise
362
- //console.log("Opened db", this.dbName, this.storeName)
362
+ this.db.addEventListener("close", (event) => {
363
+ console.log("database close event", this.idbName)
364
+ this.openDb()
365
+ })
366
+ console.log("Opened db", this.dbName, this.storeName)
363
367
  }
364
368
  async openChannel() {
365
369
  this.channel = new BroadcastChannel('lc-db-channel' + this.dbName + '-' + this.storeName, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/db-store-indexeddb",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "Database with observable data for live queries",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,9 +26,9 @@
26
26
  "tape": "^5.3.2"
27
27
  },
28
28
  "dependencies": {
29
- "@live-change/dao": "0.5.15",
29
+ "@live-change/dao": "0.5.17",
30
30
  "@live-change/interval-tree": "^1.0.12",
31
31
  "broadcast-channel": "^4.2.0"
32
32
  },
33
- "gitHead": "8dc4ac726243970c9f1431bf67b4390f7845ce76"
33
+ "gitHead": "59500898eff7eba564a06bec348cb34965b38b0a"
34
34
  }