Function timeout

  • Create a TimeoutRunner to run tasks (promises) with timeout

    Sample:

    await xaa.timeout(1000, "timeout fetching data").run(() => fetch(url))
    

    with promises:

    await xaa.timout(1000).run([promise1, promise2])
    

    Type Parameters

    • T

    Parameters

    • maxMs: number

      number of milliseconds to allow tasks to run

    • rejectMsg: string = "xaa TimeoutRunner operation timed out"

      message to reject with when timeout triggers

    • options: TimeoutRunnerOptions = ...

    Returns TimeoutRunner<T>

    TimeoutRunner object