Giter Club home page Giter Club logo

vue-local-storage-reactivity's Introduction

vue-local-storage-reactivity

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 localStorage keys are of interest beforehand
  • Reacts to localStorage changes 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.

vue-local-storage-reactivity's People

Contributors

arikw avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.