0.1.1 • Published 2 years ago
@ekwoka/persistedstore v0.1.1
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!