@ekwoka/persistedstore

0.1.1Β β€’Β PublicΒ β€’Β Published

Welcome to @ekwoka/persistedstore πŸ‘‹

npm version License: MIT

Simple Tool for having Alpine Stores persist across pages and sessions. This is based on @ryangjchandler/fern with a few improvements.

Install

npm i @ekwoka/persistedstore

Usage

Import and install persistedStore to your bundle with AlpineJS:

import Alpine from 'alpinejs';
import persistedStore from '@ekwoka/persistedstore';

Alpine.plugin(persistedStore);
Alpine.start();

Use wherever you would a conventional Alpine Store:

Alpine.persistedStore('darkMode',false);

Refer in the same way you would a normal store:

<button @click="$store.darkMode=true">πŸŒ™</button>

This version of persistedStore supports all primitive types, arrays, and objects. It also supports getters in the Store Object.

Author

πŸ‘€ Eric Kwoka

Show your support

Give a ⭐️ if this project helped you!

Package Sidebar

Install

npm i @ekwoka/persistedstore

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

2.45 kB

Total Files

3

Last publish

Collaborators

  • ekwoka