This is a library to use Web Storage API with Angular.
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
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.
Other Web APIs for Angular by @ng-web-apis