Socket
Socket
Sign inDemoInstall

reactive-local-storage-library

Package Overview
Dependencies
59
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    reactive-local-storage-library

This library would be particularly useful in single-page applications (SPAs) where state management is crucial, and persistence across sessions can enhance the user experience.


Version published
Weekly downloads
7
increased by16.67%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Reactive Local Storage Library

A JavaScript library for reactive interactions with local storage, making it easier to synchronize local storage data with your application's state.

Features

  • Reactive Bindings: Automatically updates the application state when local storage data changes.
  • Simplified API: Easy get and set operations with local storage, including automatic JSON parsing and stringification.
  • Subscription Model: Subscribe to changes in specific local storage keys.

Installation

Copy the index.js file into your project, or include it in your build process.

Usage

import reactiveLocalStorage from './path/to/reactive-local-storage-library';

// Subscribe to changes on a specific key
reactiveLocalStorage.subscribe('myKey', newValue => {
    console.log('Value for myKey changed:', newValue);
});

// Update the value, triggering the subscription callback
reactiveLocalStorage.set('myKey', { some: 'data' });

// Get the current value
const currentValue = reactiveLocalStorage.get('myKey');
console.log(currentValue);

// Unsubscribe from changes
reactiveLocalStorage.unsubscribe('myKey', callback);

FAQs

Last updated on 17 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc