Interface IOptions<T, U, V>

Instantiation options for polls.

Typeparam

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

Typeparam

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

Typeparam

V - The type to extend the phases supported by a poll.

interface IOptions<T, U, V> {
    auto?: boolean;
    factory: Factory<T, U, V>;
    frequency?: Partial<Frequency>;
    linger?: number;
    name?: string;
    standby?: Standby | (() => boolean | Standby);
}

Type Parameters

  • T
  • U
  • V extends string

Properties

auto?: boolean

Whether to begin polling automatically; defaults to true.

factory: Factory<T, U, V>

A factory function that is passed a poll tick and returns a poll promise.

frequency?: Partial<Frequency>

The polling frequency parameters.

linger?: number

The number of ticks to linger if poll switches to standby when-hidden. Defaults to 1.

name?: string

The name of the poll. Defaults to 'unknown'.

standby?: Standby | (() => boolean | Standby)

Indicates when the poll switches to standby or a function that returns a boolean or a Poll.Standby value to indicate whether to stand by. Defaults to 'when-hidden'.

Notes

If a function is passed in, for any given context, it should be idempotent and safe to call multiple times. It will be called before each tick execution, but may be called by clients as well.

Type declaration

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