vue-local-storage-reactivity
A Vue library that makes localStorage reactive
About
Sourced from arikw/vue-local-storage-reactivity README
A Vue.js library that provides a reactive interface to the localStorage object.
Installation
You can install the vue-local-storage-reactivity package using npm:
npm install vue-local-storage-reactivity
Compatibility
The vue-local-storage-reactivity package is compatible with Vue.js 2.6+ and 3.x
Features
Here are some advantages of the 'vue-reactive-local-storage' package:
- Does not require you to state what
localStoragekeys are of interest beforehand - Reacts to
localStoragechanges done on other tabs - Reacts to new keys as they are added to the
localStorage - Compatible with both Vue.js 2.6 and Vue.js 3.x, so it can be used in a wide range of Vue.js applications
- Tiny package size
- Zero-dependencies
Usage
To use the vue-local-storage-reactivity package, you need to import and use it as follows:
import reactiveLocalStorage from "vue-local-storage-reactivity";
The reactiveLocalStorage object provides a reactive interface to the localStorage object that holds the localStorage data that can be updates automatically when the storage gets changed on other tabs.
Here's an example of how to use the reactiveLocalStorage object in a Vue.js component:
<template>
<div>
<p>Count: {{ count }}</p>
<button @click="++count">Increment Count</button>
</div>
</template>
<script>
import reactiveLocalStorage from 'vue-local-storage-reactivity';
export default {
setup() {
return {
count: Vue.toRef(reactiveLocalStorage, 'count')
};
}
};
</script>
License
The vue-local-storage-reactivity package is open source software licensed under the MIT license.
More projects
See all →2022
Vue Static SFC Plugin for Vite
Serve ".vue" files as static assets
1 408 13/mo
2020
Sharing Components Between Nuxt 2.x And Vue CLI
A proof-of-concept project that demonstrates how components can be developed with a `Vue CLI` project and how to make them available to the `Nuxt` project
2020
Extension Page Context Runner
Run functions in page context directly from a browser extension content script
27
2020
Outlook Duplicated Items Remover
A VBA script that finds and moves duplicated items in selected outlook folders
21
2023
RX Input Layout Switcher
Alt+Shift keyboard layout switcher GNOME Shell Extension
16 9.6K
2025
Podman OpenRC Restart Policy Manager
This OpenRC init script manages the automatic startup and shutdown of Podman containers with the `restart-policy=always` on system boot or shutdown
5