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

19 lines (18 loc) • 744 B
import { t as HydrationSignal } from "../hydration-DclSpq51.mjs"; import { Readable } from "svelte/store"; //#region src/adapters/frameworks/svelte-store.d.ts /** * Mount a `HydrationSignal` into a Svelte `readable` store. Auto-subscribe * with `$hydratedStore`. Null/undefined signal → a store that stays `true`; * the subscription is tied to the store's subscriber lifecycle (start on first * subscriber, unsubscribe on the last). Yields `true` on the server. * * @example * ```ts * const hydrated = hydratedStore(prefsHydration); * // {#if !$hydrated}<Skeleton />{:else}<Prefs />{/if} * ``` */ declare function hydratedStore(signal: HydrationSignal | null | undefined): Readable<boolean>; //#endregion export { hydratedStore };