UNPKG

@signaldb/indexeddb

Version:

This is the `IndexedDB` persistence adapter for [SignalDB](https://github.com/maxnowack/signaldb). SignalDB is a local-first JavaScript database with real-time sync, enabling optimistic UI with signal-based reactivity across multiple frameworks.

16 lines (15 loc) 864 B
/** * Creates a persistence adapter for managing a SignalDB collection using IndexedDB. * This adapter reads and writes data to an IndexedDB object store, with customizable serialization and deserialization. * @template T - The type of the items in the collection. * @template I - The type of the unique identifier for the items. * @param name - A unique name for the collection, used as the database name. * @param options - Optional configuration for the adapter. * @param options.prefix - A prefix to be added to the database name (default: 'signaldb-'). * @returns A SignalDB persistence adapter for managing data in IndexedDB. */ export default function createIndexedDBAdapter<T extends { id: I; } & Record<string, any>, I extends IDBValidKey>(name: string, options?: { prefix?: string; }): import("@signaldb/core").PersistenceAdapter<T, I>;