reactive-localstorage
A reactive localStorage with no dependency
Install
yarn add reactive-localstorage
npm i -S reactive-localstorage
Features
- inject window.localStorage / window.sessionStorage
- Emit changes from same window
- Emit external changes
Usage
Changes from reactive-localstorage
or other pages will be emitted as events
; localStorage; localStorage; // print key foo changed to bar
It also works with window.localStorage
windowlocalStorage; // print key foo changed to alice
You can also trigger changes manually, especially when you have other sources that manage localStorage.
localStorage; // print key foo changed to bob
SessionStorage is also supported
; sessionStorage; sessionStorage; // print key foo changed to bar