@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
20 lines (19 loc) • 751 B
text/typescript
import { t as HydrationSignal } from "../hydration-DclSpq51.mjs";
import { Ref } from "vue";
//#region src/adapters/frameworks/vue.d.ts
/**
* Mount a `HydrationSignal` into Vue's reactivity. Returns a `Ref<boolean>`;
* call inside `setup()` or an `effectScope()` — the subscription is cleaned up
* via `onScopeDispose` (the scope owns teardown). Null/undefined signal → a
* ref that stays `true`. Renders `true` on the server.
*
* @example
* ```ts
* // inside setup() — onScopeDispose is active
* const hydrated = useHydrated(prefsHydration);
* // <Skeleton v-if="!hydrated" /><PrefsPanel v-else />
* ```
*/
declare function useHydrated(signal: HydrationSignal | null | undefined): Ref<boolean>;
//#endregion
export { useHydrated };