svelte-persist
Gate Svelte 5 runes UI on Persist hydration with hydratedRune (.current). Use for Svelte 5; for stores / Svelte 3–4 use svelte-store-persist.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Gate Svelte 5 runes UI on Persist hydration with hydratedRune (.current). Use for Svelte 5; for stores / Svelte 3–4 use svelte-store-persist.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Gate Alpine.js UI on Persist hydration (Alpine.plugin + useHydrated / $hydrated). Use when wiring HydrationSignal into Alpine data components.
Gate Angular UI on Persist hydration with useHydrated (readonly Signal). Call inside an injection context; use when avoiding flash of default state on async backends.
Gate Lit element UI on Persist hydration with HydrationController. Use when wiring HydrationSignal into a ReactiveControllerHost; not a hook.
Persist with React Native AsyncStorage via @stainless-code/persist/backends/async-storage. Use for RN string-wire JSON state; always gate with useHydrated.
Compress a string-wire StateStorage with @stainless-code/persist/backends/compressed (gzip/deflate). Backend wrapper — compose with createStorage; stack compress-then-encrypt.
Cross-tab sync for backends without storage events via @stainless-code/persist/transport/crosstab (createBroadcastCrossTab). Wrap storage + pass crossTabEventTarget; call close() on teardown.
| name | svelte-persist |
| description | Gate Svelte 5 runes UI on Persist hydration with hydratedRune (.current). Use for Svelte 5; for stores / Svelte 3–4 use svelte-store-persist. |
| license | MIT |
| metadata | {"type":"framework","library":"@stainless-code/persist","library_version":"0.4.1","framework":"svelte"} |
| requires | ["persist"] |
| sources | ["stainless-code/persist:src/adapters/frameworks/svelte.ts"] |
@stainless-code/persist/frameworks/svelte exports hydratedRune(signal) → { readonly current: boolean }. Read .current inside $derived / $effect / {#if} (createSubscriber is lazy inside a reactive owner).
Stores / Svelte 3–4 / Svelte 5 store users → svelte-store-persist (./frameworks/svelte-store).
bun add @stainless-code/persist svelte
Needs Svelte 5.7+ for svelte/reactivity createSubscriber (package peer allows >=3 because of the separate store entry).
<script>
import { hydratedRune } from "@stainless-code/persist/frameworks/svelte";
const hydrated = hydratedRune(prefsHydration);
</script>
{#if !hydrated.current}
<Skeleton />
{:else}
<Prefs />
{/if}
Null/undefined → current: true. SSR: hydrated true.
svelte-store-persist..current outside a reactive owner — subscribe is a no-op.useHydrated name — runes API is hydratedRune.hydratedRune(signal) → { readonly current: boolean }See also: svelte-store-persist.