Class Poll<T, U, V>

A class that wraps an asynchronous function to poll at a regular interval with exponential increases to the interval length if the poll fails.


T - The resolved type of the factory's promises. Defaults to any.


U - The rejected type of the factory's promises. Defaults to any.


V - An optional type to extend the phases supported by a poll. Defaults to standby, which already exists in the Phase type.

Type Parameters

  • T = any
  • U = any
  • V extends string = "standby"




_disposed: Signal<Poll<T, U, V>, void> = ...
_factory: Factory<T, U, V>
_frequency: Frequency
_linger: number
_lingered: number = 0
_standby: Standby | (() => boolean | Standby)

Type declaration

    • (): boolean | Standby
    • Returns boolean | Standby

_state: State<T, U, V>
_tick: PromiseDelegate<Poll<T, U, V>> = ...
_ticked: Signal<Poll<T, U, V>, State<T, U, V>> = ...
_timeout: undefined | number
name: string

The name of the poll.



  • Refreshes the poll. Schedules refreshed tick if necessary.

    Returns Promise<void>

    A promise that resolves after tick is scheduled and never rejects.


    The returned promise resolves after the tick is scheduled, but before the polling action is run. To wait until after the poll action executes, await the poll.tick promise: await poll.refresh(); await poll.tick;

  • Schedule the next poll tick.


    • next: Partial<State<T, U, V> & {
          cancel: ((last) => boolean);
      }> = {}

      The next poll state data to schedule. Defaults to standby.

    Returns Promise<void>

    A promise that resolves when the next poll state is active.


    This method is not meant to be invoked by user code typically. It is public to allow poll instances to be composed into classes that schedule ticks.