Skip to content

Created by Fabien Dehopré

Import

import { poll } from 'ngxtension/poll';

Usage

You can use this operator to poll and API at a fixed interval with an optional initial delay.

import { HttpClient } from '@angular/common/http';
import { inject } from '@angular/core';
import { poll } from 'ngxtension/poll';
const httpClient = inject(HttpClient);
httpClient
.get('https://api.example.com/data')
.pipe(
poll(10000, 5000), // poll every 10s after 5s
)
.subscribe(console.log);