Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "internal/util/poll"

Index

Functions

Functions

poll

  • poll(fn: () => boolean, duration?: number): Promise<void>
  • Run a function periodically until it returns true or until the timeout expires. Its polling period is 1/10th the timeout. If the timeout expires before the function returns true, the Promise will be rejected. The function will be tried immediately and when the total duration is reached.

    Parameters

    • fn: () => boolean

      Function to call periodically

        • (): boolean
        • Returns boolean

    • Default value duration: number = 1000

      Total length of time to poll in millisends

    Returns Promise<void>

    Resolved Promise if function returns true within the timeout period, rejected Promise if not

sleep

  • sleep(ms: number): Promise<void>

Generated using TypeDoc