@ekwoka/persistedstore
v0.1.1
Published
<h1 align="center">Welcome to @ekwoka/persistedstore 👋</h1> <p> <a href="https://www.npmjs.com/package/@ekwoka/persistedstore"><img src="https://badge.fury.io/js/@ekwoka%2Fpersistedstore.svg" alt="npm version" height="18"></a> <a href="#" target="_bl
Downloads
4
Maintainers
Readme
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
- Website: http://thekwoka.net
- Github: @ekwoka
Show your support
Give a ⭐️ if this project helped you!