• Executes an asynchronous callback that takes an AbortSignal and makes it cancellable via the given cancel token. If the cancel token is never triggered, then the promise will resolve as normal. However, if the cancel token is triggered and the promise is not yet resolved, then it will be rejected with an instance of Cancellation.

    Type Parameters

    • T

    Parameters

    • action: ((signal: AbortSignal) => PromiseLike<T>)

      The async callback to execute and make cancellable.

        • (signal): PromiseLike<T>
        • Parameters

          • signal: AbortSignal

          Returns PromiseLike<T>

    • cancelToken: CancelToken

      The cancellation token obtained from a support/Cancellable!Cancellable.

    • OptionalonCancel: ((reason: unknown) => void)

      On optional callback to trigger when the promise is about to be canceled.

        • (reason): void
        • Parameters

          • reason: unknown

          Returns void

    Returns Promise<T>

    A new promise that adds cancellation semantics to the original promise.