Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte-hydrated

Package Overview
Dependencies
Maintainers
0
Versions
31
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

  • 1.0.26
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.3K
increased by78.63%
Maintainers
0
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 18 Nov 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