Endo API documentation - v0.2.0 / Exports / @endo/promise-kit
Module: @endo/promise-kit
Table of contents
Interfaces
Type Aliases
Functions
Type Aliases
ERef
Ƭ ERef<T
>: T
| PromiseLike
<T
>
A reference of some kind for to an object of type T. It may be a direct reference to a local T. It may be a local presence for a remote T. It may be a promise for a local or remote T. Or it may even be a thenable (a promise-like non-promise with a "then" method) for a T.
Type parameters
Name |
---|
T |
Defined in
PromiseRecord
Ƭ PromiseRecord<T
>: PromiseKit
<T
>
Type parameters
Name |
---|
T |
Defined in
Functions
isPromise
▸ isPromise(maybePromise
): maybePromise is Promise<any>
Determine if the argument is a Promise.
Parameters
Name | Type | Description |
---|---|---|
maybePromise | unknown | The value to examine |
Returns
maybePromise is Promise<any>
Whether it is a promise
Defined in
makePromiseKit
▸ makePromiseKit<T
>(): PromiseKit
<T
>
makePromiseKit() builds a Promise object, and returns a record containing the promise itself, as well as separate facets for resolving and rejecting it.
Type parameters
Name |
---|
T |
Returns
PromiseKit
<T
>
Defined in
racePromises
▸ racePromises<T
>(values
): Promise
<Awaited
<T
>>
Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
Unlike Promise.race
it cleans up after itself so a non-resolved value doesn't hold onto the result promise.
Type parameters
Name |
---|
T |
Parameters
Name | Type | Description |
---|---|---|
values | Iterable <T > | An iterable of Promises. |
Returns
Promise
<Awaited
<T
>>
A new Promise.