@rifo/rxjs-polling
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

RxjsPolling

This library come to aid when we need to do polling requests. The library take care to do the polling when data is resolved. This strategy help us to prevent send requests before the previous request return.

Prerequisites

project have dependencies that require rxjs 6.4.0 or higher.

Table of Contents

Installation

npm i @rifo/rxjs-polling 

Usage

import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { pollingOnResolved } from '@rifo/rxjs-polling';

@Component({
  selector: 'app-root',
  templateUrl: `<div>{{response$ | async}}</div>`,
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  response$: Observable<string>;
  constructor(private http: HttpClient) {
     const httpRequest$ = this.http.get(`https://blockchain.info/ticker`);
     this.response$ = pollingOnResolved(httpRequest$, 2_000);
  }
}

Dependents (0)

Package Sidebar

Install

npm i @rifo/rxjs-polling

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

20.2 kB

Total Files

21

Last publish

Collaborators

  • ofir.fridman