Socket
Socket
Sign inDemoInstall

reactive-localstorage

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    reactive-localstorage

A reactive localStorage with no dependency


Version published
Weekly downloads
751
decreased by-25.12%
Maintainers
1
Install size
20.8 kB
Created
Weekly downloads
 

Readme

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

Last updated on 22 Aug 2018

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