1- import { Store } from './Store .js' ;
2- export { Store } ;
1+ import { KV } from './KV .js' ;
2+ export { KV } ;
33
4- export class IDBStore extends Store {
4+ export class IndexedDBKV extends KV {
55
66 static #dbCache = new Map ;
77
@@ -10,7 +10,7 @@ export class IDBStore extends Store {
1010 #storeName;
1111 #channel;
1212
13- constructor ( { dbName = 'webqit_store ' , channel = null , ...options } ) {
13+ constructor ( { dbName = 'webqit_keyval ' , channel = null , ...options } ) {
1414 super ( options ) ;
1515 this . #dbName = dbName ;
1616 this . #storeName = this . path . join ( ':' ) ;
@@ -27,7 +27,7 @@ export class IDBStore extends Store {
2727 db . close ( ) ;
2828
2929 // Invalidate local handle so next op reopens
30- IDBStore . #dbCache. delete ( this . #dbName) ;
30+ IndexedDBKV . #dbCache. delete ( this . #dbName) ;
3131
3232 this . #db = null ;
3333 } ;
@@ -36,8 +36,8 @@ export class IDBStore extends Store {
3636 async #open( ) {
3737 const cacheKey = this . #dbName;
3838
39- if ( IDBStore . #dbCache. has ( cacheKey ) ) {
40- this . #db = IDBStore . #dbCache. get ( cacheKey ) ;
39+ if ( IndexedDBKV . #dbCache. has ( cacheKey ) ) {
40+ this . #db = IndexedDBKV . #dbCache. get ( cacheKey ) ;
4141 if ( this . #db. objectStoreNames . contains ( this . #storeName) ) {
4242 return this . #db;
4343 }
@@ -75,7 +75,7 @@ export class IDBStore extends Store {
7575 this . #db = initialDB ;
7676 }
7777
78- IDBStore . #dbCache. set ( cacheKey , this . #db) ;
78+ IndexedDBKV . #dbCache. set ( cacheKey , this . #db) ;
7979 this . #attachDBLifecycle( this . #db) ;
8080 return this . #db;
8181 }
@@ -103,7 +103,7 @@ export class IDBStore extends Store {
103103 this . #channel?. close ( ) ;
104104 this . #db?. close ( ) ;
105105
106- IDBStore . #dbCache. delete ( this . #dbName) ;
106+ IndexedDBKV . #dbCache. delete ( this . #dbName) ;
107107 this . #db = null ;
108108
109109 await super . close ( ) ;
0 commit comments