📦 Alpine JS plugin to extend the functionality of the official $persist plugin

Overview

Alpine JS Persist Extended

Alpine JS magic method $storage extends the official $persist plugin to help you work with local storage 📦

Example 👀

<div
  x-data="{ name: $persist('') }"
  x-on:storage-delete.window="name = $storage('name')"
>
  <h2 x-text="name"></h2>

  <input type="text" x-model="name" />

  <button x-on:click="alert($storage('name'))">Alert Name</button>

  <button x-on:click="$storage('name', 'delete')">Delete Name</button>
</div>

Get

$storage("name");

Gets the value from local storage of the provided key. It's not required, but you can pass 'get' as a second parameter.

Delete

$storage("name", "delete");

Delete the data from local storage. This also emits an event that you can listen for in Alpine JS.

<div x-on:storage-delete.window="name = $storage('name')"></div>

Install 🌟

It's very easy to install Alpine JS plugins! 🙌

CDN

<script
  defer
  src="https://unpkg.com/alpinejs-persist-extended@latest/dist/storage.min.js"
></script>

<script
  defer
  src="https://unpkg.com/@alpinejs/[email protected]/dist/cdn.min.js"
></script>

<script defer src="https://unpkg.com/[email protected]/dist/cdn.min.js"></script>

NPM/Yarn

npm i -D alpinejs-persist-extended

yarn add -D alpinejs-persist-extended

Then you can register the plugin.

import Alpine from "alpinejs";
import storage from "alpinejs-persist-extended";

Alpine.plugin(storage);

window.Alpine = Alpine;

Alpine.start();

Stats 📊

Here's some stats about the Alpine JS Persist Extended package! As you can see, it's tiny 🤏

You might also like...

Add focal point alignment of images to your Alpine 3.x components with a custom directive.

Alpine Focal Add focal point alignment of images to your Alpine 3.x components with a custom directive. This package only supports Alpine v3.x. About

Oct 12, 2021

Animate your Alpine components.

Animate your Alpine components 🚀 This package provides you with a simple helper to animate your ALpine.js components. Installation The recommended wa

Nov 16, 2022

Adds a handy $parent magic property to your Alpine components.

✨ Help support the maintenance of this package by sponsoring me. Alpine $parent Access parent components using a handy $parent magic variable. This pa

Aug 29, 2022

A clean integration between Cleave.js and Alpine. ✨

✨ Help support the maintenance of this package by sponsoring me. Alpine Mask This packages provide a custom x-mask directive and $mask magic variable,

Dec 26, 2022

A simple library for handling keyboard shortcuts with Alpine.js.

✨ Help support the maintenance of this package by sponsoring me. Alpine.js Mousetrap A simple library for handling keyboard shortcuts with Alpine.js.

Nov 14, 2022

IntelliSense for Alpine.js

IntelliSense for Alpine.js

IntelliSense for Alpine.js Features Provides syntax highlighting for Alpine.js directives along with autocomplete for all base directives and modifier

Nov 17, 2022

E-commerce website using Laravel, Tailwindcss and Alpine.js

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Dec 12, 2022

Multi-step wizard helpers for Alpine.js

Multi-step wizard helpers for Alpine.js

Alpine Wizard This package provides an Alpine directive (x-wizard) and a magic helper ($wizard) that allow you to quickly build multi-step wizards usi

Dec 23, 2022

Alpine.js Language Features (Volar) extension for coc.nvim

[Experimental] coc-volar-alpinejs fork from vscode-alpine-language-features Alpine Language Features extension for coc.nvim Note @volar/alpine-languag

Oct 12, 2022
Comments
  • update/improvements

    update/improvements

    This PR adds some general improvements to the package.

    Updated

    • Removed requirement to pass through _x_ on local storage keys
    • Removed requirement to pass 'get' when fetching data from local storage
    • Removed second browser event that's emitted when deleting data
    enhancement 
    opened by markmead 0
Next js boilerplate with redux toolkit, redux persist and axios

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Jorge Alberto Villarreal Gongora 5 Apr 25, 2022
🤖 Persist the Playwright executable between Netlify builds

?? Netlify Plugin Playwright Cache Persist the Playwright executables between Netlify builds. Why netlify-plugin-playwright-cache When you install pla

Hung Viet Nguyen 14 Oct 24, 2022
基于React开发的新一代web调试工具,支持React组件调试,类似于Chrome Devtools。A Lightweight, Easy To Extend Web Debugging Tool Build With React

English | 简体中文 基于React开发的移动web调试工具 更新日志 简单易用 功能全面 易扩展 高性能 使用cdn方式,一键接入 类Chrome devtools, 内嵌React开发者工具,支持日志,网络,元素,代理,存储,性能等, 具有更好的网络捕获能力和丰富的日志展现形式 暴露内部

腾讯TNTWeb前端团队 236 Dec 25, 2022
Avatar classes to extend Bootstrap 5.

Bootstrap Avatar A collection of fixed and responsive CSS for styling avatars. Demo https://ghoststead.github.io/bootstrap-avatar Installation jsDeliv

null 4 May 22, 2022
Minimalistic configuration for TS to only extend JS with types. No TS features, no bundling. Readable maintainable code after compilation.

ts-guideline Minimalistic configuration for TS to only extend JS with types. No TS-scpecific features, no bundling. Readable maintainable code after c

Georg Oldenburger 41 Dec 22, 2022
Forked from hayes0724/shopify-packer Modern development tool for Shopify using Webpack 5. Easy to extend and customize, zero build config, compatible with Slate and existing websites.

Shopify Packer Modern development tool for Shopify using Webpack 5. Easy to extend and customize, zero build config, comes with starter themes and com

Web & Mobile | eCommerce | Full-Stack Developer 4 Nov 24, 2022
New base script bot wa by Ramdani Official, don't forget to subscribe youtube Ramdani Official.

Requirements • Installation • Thanks to • Official Group Bot • Donate Information bahasa Indonesia Ramdani Botz V17 adalah bot yang di ciptakan oleh R

Ramdani Official 22 Nov 1, 2022
⏱ Simple Alpine.js plugin to display the human-readable distance between a date and now.

⏱ Alpine TimeAgo ⏱ An Alpine.js plugin to return the distance between a given date and now in words (like "3 months ago", "about 2 hours ago" or "in a

Marc Reichel 47 Dec 22, 2022
↕️ A little Alpine.js plugin to automatically resize a textarea to fit its content.

↕️ Alpine Autosize ↕️ A little Alpine.js plugin to automatically resize a textarea to fit its content. ?? Installation CDN Include the following <scri

Marc Reichel 42 Nov 5, 2022
Little Alpine.js plugin to add a typewriter effect to any HTML element.

⌨️ Alpine Typewriter ⌨️ An Alpine.js plugin to add a typewriter effect to any HTML element. ?? Installation CDN Include the following <script> tag in

Marc Reichel 58 Dec 28, 2022