xaa
    Preparing search index...

    Class TimeoutRunner<T>

    TimeoutRunner for running tasks (promises) with a timeout

    Please use xaa.timeout or xaa.runTimeout APIs instead.

    Type Parameters

    • T
    Index

    Constructors

    • constructor

      Type Parameters

      • T

      Parameters

      • maxMs: number

        number of milliseconds to allow tasks to run

      • rejectMsg: string

        message to reject with when timeout triggers

      • options: TimeoutRunnerOptions

        TimeoutRunnerOptions

      Returns TimeoutRunner<T>

    Properties

    error?: Error

    the error if running failed

    maxMs: number

    number of milliseconds to allow tasks to run

    rejectMsg: string

    message to reject with if operation timed out

    result?: T | T[]

    the result from running tasks

    ThePromise: PromiseConstructor

    Promise constructor

    TimeoutError: typeof TimeoutError

    TimeoutError constructor

    Methods

    • Cancel the operation and reject with msg

      Parameters

      • msg: string = "xaa TimeoutRunner operation cancelled"

        cancel message

      Returns void

    • Explicitly clear the setTimeout handle

      Returns void

    • check if runner has failed with error

      Returns boolean

      has error flag

    • check if runner has finished with result

      Returns boolean

      has result flag

    • Check if runner is done

      Returns boolean

      is done flag

    • Run tasks

      Type Parameters

      • U extends Tasks<T<T>> | Task<T>

      Parameters

      • tasks: U

        Promise or function that returns Promise, or array of them.

      Returns Promise<T | T[]>

      Promise to wait for tasks to complete, or timeout error.