what the CancellablePromise
resolves to
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.
Analogous to Promise.reject
.
Like CancellablePromise.resolve
, canceling the returned
CancellablePromise
is a no-op.
this should probably be an Error
object
Analogous to Promise.all
.
an array that may contain CancellablePromise
s, promises,
thenables, and resolved values
a CancellablePromise
, which, if canceled, will cancel each
of the promises passed in to CancellablePromise.all
.
Analogous to Promise.all
.
an array that may contain CancellablePromise
s, promises,
thenables, and resolved values
a CancellablePromise
, which, if canceled, will cancel each
of the promises passed in to CancellablePromise.all
.
Analogous to Promise.all
.
an array that may contain CancellablePromise
s, promises,
thenables, and resolved values
a CancellablePromise
, which, if canceled, will cancel each
of the promises passed in to CancellablePromise.all
.
Analogous to Promise.all
.
an array that may contain CancellablePromise
s, promises,
thenables, and resolved values
a CancellablePromise
, which, if canceled, will cancel each
of the promises passed in to CancellablePromise.all
.
Analogous to Promise.all
.
an array that may contain CancellablePromise
s, promises,
thenables, and resolved values
a CancellablePromise
, which, if canceled, will cancel each
of the promises passed in to CancellablePromise.all
.
Analogous to Promise.all
.
an array that may contain CancellablePromise
s, promises,
thenables, and resolved values
a CancellablePromise
, which, if canceled, will cancel each
of the promises passed in to CancellablePromise.all
.
Analogous to Promise.all
.
an array that may contain CancellablePromise
s, promises,
thenables, and resolved values
a CancellablePromise
, which, if canceled, will cancel each
of the promises passed in to CancellablePromise.all
.
Analogous to Promise.all
.
an array that may contain CancellablePromise
s, promises,
thenables, and resolved values
a CancellablePromise
, which, if canceled, will cancel each
of the promises passed in to CancellablePromise.all
.
Analogous to Promise.all
.
an array that may contain CancellablePromise
s, promises,
thenables, and resolved values
a CancellablePromise
, which, if canceled, will cancel each
of the promises passed in to CancellablePromise.all
.
Analogous to Promise.all
.
an array that may contain CancellablePromise
s, promises,
thenables, and resolved values
a CancellablePromise
, which, if canceled, will cancel each
of the promises passed in to CancellablePromise.all
.
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
.
Creates a CancellablePromise
that is resolved with an array of results
when all of the provided Promise
s resolve or reject.
An array of Promise
s.
A new CancellablePromise
. Canceling it cancels all of the input
promises.
Creates 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.
a CancellablePromise
that resolves after ms
milliseconds.
Analogous to Promise.then
.
onFulfilled
on onRejected
can return a value, a normal promise, or a
CancellablePromise
. So you can make a chain a CancellablePromise
s
like this:
const overallPromise = cancellableAsyncFunction1()
.then(cancellableAsyncFunction2)
.then(cancellableAsyncFunction3)
.then(cancellableAsyncFunction4)
Then if you call overallPromise.cancel
, cancel
is called on all
CancellablePromise
s in the chain! In practice, this means that
whichever async operation is in progress will be canceled.
a new CancellablePromise
Analogous to Promise.catch
.
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
The callback to execute when the Promise is settled (fulfilled or rejected).
A Promise for the completion of the callback.
a normal promise or thenable
a function that cancels promise
. Calling cancel
after
promise
has resolved must be a no-op.
As 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.
Cancel the CancellablePromise
.
Generated using TypeDoc
This example shows off how TypeDoc handles
A promise with a
cancel
method. If canceled, theCancellablePromise
will reject with aCancellation
object. Originally from real-cancellable-promise.