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

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

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

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

// print key foo changed to alice

You can also use injection to override window.localStorage

import 'reactive-localstorage/lib/inject';
import localStorage from 'reactive-localstorage';

console.log(window.localStorage === localStorage);

// print true
  • mobx-localstorage
  • rx-localstorage

Keywords

FAQs

Package last updated on 22 Aug 2018

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