UNPKG

@bigmi/client

Version:

Reactive primitives for Bitcoin apps.

21 lines (20 loc) 1.09 kB
import { Storage, StorageItemMap } from "../types/storage.js"; import { Compute } from "@bigmi/core"; //#region src/factories/createStorage.d.ts type BaseStorage = { getItem(key: string): string | null | undefined | Promise<string | null | undefined>; setItem(key: string, value: string): void | Promise<void>; removeItem(key: string): void | Promise<void>; }; type CreateStorageParameters = { deserialize?: (<type>(value: string) => type | unknown) | undefined; key?: string | undefined; serialize?: (<type>(value: type | any) => string) | undefined; storage?: Compute<BaseStorage> | undefined; }; declare function createStorage<itemMap extends Record<string, unknown> = Record<string, unknown>, storageItemMap extends StorageItemMap = StorageItemMap & itemMap>(parameters: CreateStorageParameters): Compute<Storage<storageItemMap>>; declare const noopStorage: BaseStorage; declare function getDefaultStorage(): BaseStorage; //#endregion export { BaseStorage, CreateStorageParameters, createStorage, getDefaultStorage, noopStorage }; //# sourceMappingURL=createStorage.d.ts.map