Socket
Socket
Sign inDemoInstall

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


Version published
Weekly downloads
690
increased by19.79%
Maintainers
1
Weekly downloads
 
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 06 Mar 2019

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