Options
All
  • Public
  • Public/Protected
  • All
Menu

Module AsyncTools

A set of utilities for working with asynchronous things.

Index

Classes

Functions

Functions

wait

  • wait(ms?: undefined | number): Promise<unknown>
  • Wait some number of milliseconds before continuing.

    This returns a promise that resolves when at least 1 VM turn has passed- this means that wait cannot wait for any shorter than ~1-4ms depending on browser.

    Parameters

    • Optional ms: undefined | number

    Returns Promise<unknown>

waitForFrame

  • waitForFrame(): Promise<unknown>
  • Like wait, except it will wait for the next frame paint before resolving.

    export

    Returns Promise<unknown>

waitUntil

  • waitUntil(predicate: function, timeout: number, interval?: number): Promise<void>
  • Wait until a predicate returns true.

    Like wait, this returns a promise that resolves when at least 1 VM turn has passed. This promise is rejected if the timeout is reached before the predicate becomes true. By default, the predicate is run every 25ms, but is configurable.

    For user actions, use a timeout of ~300ms to prevent studder

    Parameters

    • predicate: function
        • (): boolean
        • Returns boolean

    • timeout: number
    • Default value interval: number = 25

    Returns Promise<void>

Generated using TypeDoc