what the CancellablePromise resolves to
Descriptions can be added for groups with @groupDescription, which will show up in
the index where groups are listed. This works for both manually created groups which
are created with @group, and implicit groups like the Methods group that this
description is attached to.
a normal promise or thenable
a function that cancels promise. Calling cancel after
promise has resolved must be a no-op.
Protected ReadonlypromiseAs a consumer of the library, you shouldn't ever need to access
CancellablePromise.promise directly.
If you are subclassing CancellablePromise for some reason, you
can access this property.
ReadonlycancelCancel the CancellablePromise.
Analogous to Promise.then.
onFulfilled on onRejected can return a value, a normal promise, or a
CancellablePromise. So you can make a chain a CancellablePromises
like this:
const overallPromise = cancellableAsyncFunction1()
.then(cancellableAsyncFunction2)
.then(cancellableAsyncFunction3)
.then(cancellableAsyncFunction4)
Then if you call overallPromise.cancel, cancel is called on all
CancellablePromises in the chain! In practice, this means that
whichever async operation is in progress will be canceled.
a new CancellablePromise
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
OptionalonFinally: (() => void) | nullThe callback to execute when the Promise is settled (fulfilled or rejected).
A Promise for the completion of the callback.
StaticresolveAnalogous to Promise.resolve.
The returned promise should resolve even if it is canceled. The idea is that the promise is resolved instantaneously, so by the time the promise is canceled, it has already resolved.
Analogous to Promise.resolve.
The returned promise should resolve even if it is canceled. The idea is that the promise is resolved instantaneously, so by the time the promise is canceled, it has already resolved.
StaticrejectAnalogous to Promise.reject.
Like CancellablePromise.resolve, canceling the returned
CancellablePromise is a no-op.
Optionalreason: unknownthis should probably be an Error object
StaticallStaticallCreates a CancellablePromise that is resolved with an array of results
when all of the provided Promises resolve or reject.
An array of Promises.
A new CancellablePromise.
Creates a CancellablePromise that is resolved with an array of results
when all of the provided Promises resolve or reject.
An array of Promises.
A new CancellablePromise. Canceling it cancels all of the input
promises.
StaticraceCreates a CancellablePromise that is resolved or rejected when any of
the provided Promises are resolved or rejected.
An array of Promises.
A new CancellablePromise. Canceling it cancels all of the input
promises.
Staticdelaya CancellablePromise that resolves after ms milliseconds.
This example shows off how TypeDoc handles
A promise with a
cancelmethod. If canceled, theCancellablePromisewill reject with aCancellationobject. Originally from real-cancellable-promise.