storage
storage copied to clipboard
A library to use Web Storage API with Observables
Attention! This repository is archived and the library has been moved to tinkoff/ng-web-apis monorepository
Web Storage API for Angular
Part of
Web APIs 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_EVENTtoken to inject anObservableofStorageEvent. - Use
filterByKeyandtoValueutility operators to work with thisObservable. - Native
StorageEventonly fires when changes are made from another tab. To capture events from the same tab useStorageServiceto work withlocalStorage
See demo for concrete usage example.
See also
Other Web APIs for Angular by @ng-web-apis
Open-source
Do you also want to open-source something, but hate the collateral work? Check out this Angular Open-source Library Starter we’ve created for our projects. It got you covered on continuous integration, pre-commit checks, linting, versioning + changelog, code coverage and all that jazz.