View as Markdown

API reference: @salmonui/data/storage

KeyValueStoreinterface

import type { KeyValueStore } from '@salmonui/data/storage';

Also exported from @salmonui/data.

interface KeyValueStore {
    getItem(key: string): string | null | undefined | Promise<string | null | undefined>;
    setItem(key: string, value: string): void | Promise<void>;
    removeItem(key: string): void | Promise<void>;
}

Any sync or async key-value store (localStorage, sessionStorage, IndexedDB wrappers, Redis clients, Maps).

KeyValueStore members (3)
NameSignatureDescription
getItemgetItem(key: string): string | null | undefined | Promise<string | null | undefined>;
setItemsetItem(key: string, value: string): void | Promise<void>;
removeItemremoveItem(key: string): void | Promise<void>;