Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markmead/alpinejs-persist-extended
Extends the official `$persist` plugin to help you work with `localStorage` 📦
https://github.com/markmead/alpinejs-persist-extended
alpine-js alpinejs alpinejs-persist alpinejs-plugin javascript javascript-localstorage localstorage
Last synced: 3 months ago
JSON representation
Extends the official `$persist` plugin to help you work with `localStorage` 📦
- Host: GitHub
- URL: https://github.com/markmead/alpinejs-persist-extended
- Owner: markmead
- License: mit
- Created: 2022-07-02T09:22:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-04T10:53:22.000Z (10 months ago)
- Last Synced: 2024-10-14T08:24:38.274Z (4 months ago)
- Topics: alpine-js, alpinejs, alpinejs-persist, alpinejs-plugin, javascript, javascript-localstorage, localstorage
- Language: JavaScript
- Homepage: https://js.hyperui.dev/examples/storage-extended
- Size: 29.3 KB
- Stars: 19
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Alpine JS Persist Extended
Extends the official `$persist` plugin to help you work with `localStorage` 📦
## Install
### With a CDN
```html
```
### With a Package Manager
```shell
npm i -D alpinejs-persist-extendedyarn add -D alpinejs-persist-extended
``````js
import Alpine from 'alpinejs'
import storage from 'alpinejs-persist-extended'Alpine.plugin(storage)
window.Alpine = Alpine
Alpine.start()
```## Example
```html
Alert Name
Delete Name
```### Get
```js
$persistGet('fullName')
```Gets the value from `localStorage` of the provided key.
### Delete
```js
$persistDelete('fullName')
```Deletes the data from `localStorage`, it also emits an event that you can listen
for in Alpine JS.```html
```### Stats
![](https://img.shields.io/bundlephobia/min/alpinejs-persist-extended)
![](https://img.shields.io/npm/v/alpinejs-persist-extended)
![](https://img.shields.io/npm/dt/alpinejs-persist-extended)
![](https://img.shields.io/github/license/markmead/alpinejs-persist-extended)