@ng-web-apis/storage
v4.2.1
Published
A library to use Web Storage API with Observables
Downloads
3,915
Readme
Web Storage API for Angular
This is a library to use Web Storage API with Angular.
Install
If you do not have @ng-web-apis/common:
npm i @ng-web-apis/common
Now install the package:
npm i @ng-web-apis/storage
How to use
Web Storage API consists of storage synthesis and storage recognition.
- Use
STORAGE_EVENT
token to inject anObservable
ofStorageEvent
. - Use
filterByKey
andtoValue
utility operators to work with thisObservable
. - Native
StorageEvent
only fires when changes are made from another tab. To capture events from the same tab useStorageService
to work withlocalStorage
See demo for concrete usage example.
See also
Other Web APIs for Angular by @ng-web-apis