Skip to content

Simple plugin for AlpineJS that add stores that persist!

Notifications You must be signed in to change notification settings

ekwoka/persistedstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Simple plugin for AlpineJS that add stores that persist!

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published