UNPKG

@stainless-code/persist

Version:

Hydration-aware persistence for any reactive store — zero-dep persistSource core; codecs, backends, cross-tab transport, source + framework hydration adapters ship as opt-in recipes

23 lines (22 loc) • 845 B
import { t as HydrationSignal } from "../hydration-DclSpq51.mjs"; //#region src/adapters/frameworks/svelte.d.ts /** * Mount a `HydrationSignal` into Svelte 5 reactivity (`createSubscriber`). * Read `current` inside a reactive context (`$derived`/`$effect`/`{#if}`) to * track the gate. Null/undefined signal → `current` is always `true`; the * subscription is owned by the reactive context (cleaned up on dispose). * Renders `true` on the server (no-op `PersistApi`). * * Svelte 4 (pre-runes): `./frameworks/svelte-store` (`hydratedStore`). * * @example * ```ts * const hydrated = hydratedRune(prefsHydration); * // {#if !hydrated.current}<Skeleton />{:else}<Prefs />{/if} * ``` */ declare function hydratedRune(signal: HydrationSignal | null | undefined): { readonly current: boolean; }; //#endregion export { hydratedRune };