UNPKG

@sv-use/core

Version:

A collection of Svelte 5 utilities.

21 lines (20 loc) 767 B
type SessionStateOptions<T> = { /** Defaults to `JSON.stringify`. */ serialize?: (value: T) => string; /** Defaults to `JSON.parse`. */ deserialize?: (value: string) => T; /** If the key is present in session storage, override that value or not. */ overrideDefault?: boolean; }; /** * A state that is synced with session storage. * @param key The key to use in session storage. * @param value The initial value of the state. * @param options Additional options to customize the behavior. * @returns A reactive `current` property. * @see https://svelte-librarian.github.io/sv-use/docs/core/session-state */ export declare function sessionState<T>(key: string, value: T, options?: SessionStateOptions<T>): { current: T; }; export {};