use-idb-store
Version:
A React state hook that syncs state to IndexedDB for persistent, offline-friendly, and large-scale data storage.
23 lines (22 loc) • 675 B
TypeScript
export declare class DB {
private static instance;
private dbName;
private indexedDB;
private stores;
private version;
private dbInitPromise;
private isClosing;
private constructor();
static getInstance(): DB;
/**
* Sets up event handlers for multi-tab coordination
*/
private setupDatabaseEventHandlers;
private getCurrentDatabaseVersion;
private sync;
private initializeDatabase;
createStore(name: string, schema?: IDBObjectStoreParameters): Promise<void>;
getStore(name: string): Promise<IDBObjectStore>;
clearStore(name: string): Promise<void>;
deleteStore(name: string): Promise<void>;
}