UNPKG

svelte-idb-store

Version:

A library that allows you to sync the value of your Svelte stores with IndexedDB

27 lines (26 loc) 947 B
import IDB from "./idb"; interface IDBStoreArray<T extends Record<string, any>> { value: T[]; getItem: (id: string) => Promise<T>; setItem: (val: T) => Promise<void>; removeItem: (id: string) => Promise<void>; clear: () => Promise<void>; } interface OptionsArray<T> { name: string; key: Extract<keyof T, string>; version?: number; initialValue?: T[]; onLoad?: () => void; onCreate?: () => void; } export declare class IDBArray<T extends Record<string, any>> extends IDB<T[], Extract<keyof T, string>> { get: () => Promise<T[]>; set: (val: T[]) => Promise<T[]>; getItem: (id: string) => Promise<T>; setItem: (val: T) => Promise<T[]>; removeItem: (id: string) => Promise<T[]>; clear: () => Promise<T[]>; } declare const _default: <T extends Record<string, any>>({ name, key, version, initialValue, onLoad, onCreate }: OptionsArray<T>) => IDBStoreArray<T>; export default _default;