🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@cloudflare/util-http-poll

Package Overview
Dependencies
Maintainers
30
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudflare/util-http-poll

Cloudflare HTTP Polling Utilities

1.3.2
latest
npm
Version published
Maintainers
30
Created
Source

util-http-poll

Cloudflare HTTP Polling Util

Installation

$ yarn add @cloudflare/util-http-poll

Usage

import { Poller } from '@cloudflare/util-http-poll';

const pollingFn = () => {
  /* do something fancy */
};

/*
 The following options can be configured:

  backoffs {Number} - The number of times to backoff and retry
                      after exceeding timeout before quitting
  pollInterval {Number} - The frequency at which to poll
  pollTimeout {Number} - The time after which we stop polling and decide what to do next
  backoffFn: {Function} - Used to decrease the pollInterval frequency
  onError: {Function} - Called when an error is thrown in pollingFn
  haltOnError: {Boolean} - Should stop polling if an error is encountered
*/
const options = { pollTimeout: 30 * 1000 };
const poller = new Poller(pollingFn, options);
poller.startPolling();

// When you're done or unmounting:
poller.destroy();

FAQs

Package last updated on 05 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts