• Creates a Promise that resolves after ms milliseconds with a value.

    Example

    Resolve after 100ms

    resolveAfterTimeout(100)
    .then(() => console.log("then")) // will be called after 100ms
    .catch(() => console.log("catch")); // this will never be called

    Example

    Resolve after 100ms with "val"

    resolveAfterTimeout(100, "val")
    .then((val) => console.log(val)) // will be called after 100ms
    .catch(() => console.log("catch")); // this will never be called

    Returns

    a Promise that resolves after ms milliseconds

    Parameters

    • ms: number

      the number of milliseconds to wait

    Returns Promise<void>

  • Creates a Promise that resolves after ms milliseconds with a value.

    Example

    Resolve after 100ms

    resolveAfterTimeout(100)
    .then(() => console.log("then")) // will be called after 100ms
    .catch(() => console.log("catch")); // this will never be called

    Example

    Resolve after 100ms with "val"

    resolveAfterTimeout(100, "val")
    .then((val) => console.log(val)) // will be called after 100ms
    .catch(() => console.log("catch")); // this will never be called

    Returns

    a Promise that resolves after ms milliseconds

    Type Parameters

    • T

    Parameters

    • ms: number

      the number of milliseconds to wait

    • value: T

    Returns Promise<T>

Generated using TypeDoc