This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

svelte-hydrated
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

svelte-hydrated

npm-version npm-license npm-download-month npm-min-size ci.yml website

💧 Indicating hydration status by svelte-store

Installation

npm i svelte-hydrated

Example

The $hydrated store is updated to true at the next tick when the browser is true

<script>
  import { hydrated } from 'svelte-hydrated'
  import { slide } from 'svelte/transition'
</script>

{#if $hydrated}
  <h2 transition:slide>Hydrated</h2>
{:else}
  <h2 transition:slide>Not Hydrated</h2>
{/if}

Why not use browser ?

The browser ($app/environment) is useful for identifying the execution environment of the code, but its value is determined before the first rendering is started.
This means that transition etc. will not be triggered when hydration completes.
The $hydrated store is updated to true at the next tick when the browser is true, making it simpler to set transition.

License

MIT

Package Sidebar

Install

npm i svelte-hydrated

Weekly Downloads

693

Version

2.0.0

License

MIT

Unpacked Size

5.58 kB

Total Files

5

Last publish

Collaborators

  • jill64