storage-hook
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

StorageHook npm version Build Status Downloads license

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');

Readme

Keywords

none

Package Sidebar

Install

npm i storage-hook

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

22.4 kB

Total Files

14

Last publish

Collaborators

  • xupeiyao