Socket
Socket
Sign inDemoInstall

svelte-hydrated

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-hydrated

💧 Indicating hydration status by svelte-store


Version published
Weekly downloads
6.6K
increased by233.86%
Maintainers
1
Weekly downloads
 
Created
Source

svelte-hydrated

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

💧 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

Keywords

FAQs

Package last updated on 03 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc