Function timeout

  • create a promise with timeout, if time is up but no result/error resolved by promise, will throw an error

    Type Parameters

    • T

    Parameters

    • executor: PromiseExecutor<T>

      the promise executor

    • timeout: number = ...

      the timeout in milliseconds, e.g. 10000 means 10 seconds, and default value is 60 seconds

    Returns Promise<T>

    Since

    5.14.0

    Throws