Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

ng-web-apis/storage

Repository files navigation



Attention! This repository is archived and the library has been moved to tinkoff/ng-web-apis monorepository



ng-web-apis logo Web Storage API for Angular

Part of Web APIs for Angular

npm version npm bundle size .github/workflows/ci.yml Coveralls github angular-open-source-starter

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.

  1. Use STORAGE_EVENT token to inject an Observable of StorageEvent.
  2. Use filterByKey and toValue utility operators to work with this Observable.
  3. Native StorageEvent only fires when changes are made from another tab. To capture events from the same tab use StorageService to work with localStorage

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.