Skip to content

joaquimnetocel/svelte-runes-store

Repository files navigation

svelte-runes-store

GITHUB VERSION NPM VERSION NPM Downloads NPM License Twitter

svelte-runes-store is a svelte package to build (persistent) svelte states that can be shared among components through the context.

GIF EXAMPLE

VERSIONS

  • WORKS WITH SVELTE 5 AND SVELTEKIT.

FEATURES

  • USES THE SVELTE 5 RUNES.
  • PERSISTENT AND NON-PERSISTENT STORES.
  • TYPESCRIPT SUPPORT.
  • ADDS STORES TO THE CONTEXT, AVOIDING STATE SHARING IN SSR.

INSTALLATION

npm install svelte-runes-store

EXAMPLES

To run the examples from /src/routes:

git clone https://github.com/joaquimnetocel/svelte-runes-store.git
cd svelte-runes-store
npm install
npm run dev

COMPONENT STRUCTURE

  • store.create: Function to create the store.
  • store.read: Function to read the store.

PARAMETERS

  • PARAMETERS OF store.create:
PARAMETER DESCRIPTION TYPE REQUIRED DEFAULT
value INITIAL VALUE OF THE STORE. Generic YES -
key CONTEXT KEY. string YES -
storage STORAGE TYPE. localStorage OR sessionStorage NO localStorage
  • PARAMETERS OF store.read:
PARAMETER DESCRIPTION TYPE REQUIRED DEFAULT
key CONTEXT KEY. string YES -

About

svelte-runes-store is a svelte/sveltekit package to build (persistent) svelte stores using runes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published