1.0.16 ā€¢ Published 11 days ago

svelte-hydrated v1.0.16

Weekly downloads
-
License
MIT
Repository
github
Last release
11 days ago

svelte-hydrated

šŸ’§ Indicating hydration status by svelte-store

Demo

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

1.0.16

11 days ago

1.0.15

22 days ago

1.0.14

1 month ago

1.0.13

1 month ago

1.0.12

2 months ago

1.0.11

2 months ago

1.0.10

2 months ago

1.0.9

3 months ago

1.0.8

3 months ago

1.0.7

3 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

0.1.0

5 months ago

1.0.0

5 months ago

0.0.1

5 months ago