storage-hook
v1.0.0
Published
Subscribeable localStorage or sessionStorage
Downloads
2
Readme
StorageHook
Subscribable localStorage or sessionStorage.
NPM
npm install storage-hook
Example
Global hook
import { StorageProxy } from 'storage-hook';
let storage = StorageProxy.create(sessionStorage);
storage.onChanged.subscribe(x => {
console.log('result: ' + x['a']);
});
storage.setItem('a', '123');
Property hook
import { StorageProxy } from 'storage-hook';
let storage = StorageProxy.create(sessionStorage);
storage.getPropertyChangeHook('a').subscribe(x => {
console.log('result: ' + x);
});
storage.setItem('a', '456');