svelte-idb-store
Version:
A library that allows you to sync the value of your Svelte stores with IndexedDB
17 lines (16 loc) • 675 B
TypeScript
import { type IDBPDatabase } from "idb";
export default abstract class<T, Key extends string> {
db: IDBPDatabase;
name?: string;
key?: Key;
version?: number;
initialValue?: T;
callback?: (creating: boolean) => void;
abstract get(): Promise<T>;
abstract set(val: T): Promise<T>;
private isBrowser;
constructor(name: string, key?: Key, version?: number, initialValue?: T, callback?: (creating: boolean) => void);
store: () => Promise<import("idb").IDBPObjectStore<unknown, ["data"], "data", "readwrite">>;
index: () => Promise<import("idb").IDBPIndex<unknown, ["data"], "data", "" | Key, "readwrite">>;
private Initialize;
}