• Set the cancellation timeout for a job.

    When the timeout is reached, the job is canceled (throwing CancelError to any waiting promises or jobs), unless a new timeout is set before then. You may set a new timeout value for a job as many times as desired. A timeout value of zero disables the timeout. Timers are disposed of if the job is canceled or restarted.

    Type Parameters

    • T

    Parameters

    • ms: number

      Optional: Number of milliseconds after which the job will be canceled. Defaults to zero if not given.

    • Optional job: Job<T>

      Optional: the job to apply the timeout to. If none is given, the active job is used.

    Returns Job<T>

    the job to which the timeout was added or removed.