JSPM

rxjs-storage

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q53746F
  • License MIT

Reactive Wrapper on Local Storage Events

Package Exports

  • rxjs-storage

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rxjs-storage) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

RxStorage

GitHub license GitHub stars GitHub build

It is a reactive wrapper around Storage Event API of DOM.

Installation

npm install rxjs-storage

Usage

Angular Example

import { Component, OnInit } from '@angular/core';
import { RxStorage } from './services/storage.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit{

  constructor(private storageService: RxStorage) {
  }

  ngOnInit() {
    this.storageService.getObservable('check').subscribe(data => {
      console.log(data);
    })
  }

}

The above example sets up a listener on a particular key the storage(localStorage or sessionSrorage). RxStorage can be used as a Service in Angular.(Add it in providers array in the respective module)

OR

RxStorage can simply be used as a class in normal js or ts code to setup a listener on the Storage.

Contributing

Create a Pull request from a fork of the repository.