Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reactive-localstorage

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactive-localstorage

A reactive localStorage with no dependency

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

reactive-localstorage

A reactive localStorage with no dependency

Install
yarn add reactive-localstorage
npm i -S reactive-localstorage
Features
  • inject window.localStorage
  • Emit changes from same window
  • Emit external changes
Usage

Changes from reactive-localstorage or other pages will be emitted as events

import localStorage from 'reactive-localstorage';

localStorage.on('change', (key, value) => {
  console.log(`key ${key} changed to ${value}`);
});

localStorage.setItem('foo', 'bar');

// print key foo changed to bar

It also works with window.localStorage

window.localStorage.setItem('foo', 'alice');

// print key foo changed to alice

You can also trigger changes manually, especially when you have other sources that manage localStorage.

localStorage.feed('foo', 'bob');

// print key foo changed to bob
  • mobx-localstorage
  • rx-localstorage

Keywords

FAQs

Package last updated on 17 Jul 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc