acquiescence - v0.1.7
    Preparing search index...

    Class RequestAnimationFrameWaiter<T>

    Waiter that polls for a condition to be met using requestAnimationFrame, with a timeout. This waiter checks the condition on every animation frame (typically ~60fps).

    Type Parameters

    • T

      The type of the result of the condition.

    Implements

    Index

    Constructors

    Methods

    Constructors

    • Initializes a new instance of the RequestAnimationFrameWaiter class.

      Type Parameters

      • T

        The type of the result of the condition.

      Parameters

      • condition: () => T | Promise<T>

        {() => T | Promise} A Function testing the condition to poll for.

      • timeoutInMilliseconds: number = 0

        {number} The timeout in milliseconds. If omitted, the timeout is zero, implying the check will execute once.

      Returns RequestAnimationFrameWaiter<T>

    Methods

    • Waits for the condition to be met.

      Returns Promise<T>

      A Promise that resolves to the result of the condition. The Promise is rejected if the timeout is reached, or if the wait is cancelled.