• Race a promise against an abort signal.

    If the signal is aborted before the promise settles, the returned promise rejects with signal.reason, and once the original promise resolves, its value is passed to cancel (since the underlying operation itself might not be cancellable, e.g. Deno.connect).

    Type Parameters

    • T

    Parameters

    • promise: Promise<T>
    • signal: undefined | AbortSignal
    • cancel: (value: T) => void

    Returns Promise<T>