Skip to content

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

src/types.js:18


PromiseRecord

Ƭ PromiseRecord<T>: PromiseKit<T>

Type parameters

Name
T

Defined in

src/types.js:13

Functions

isPromise

isPromise(maybePromise): maybePromise is Promise<any>

Determine if the argument is a Promise.

Parameters

NameTypeDescription
maybePromiseunknownThe value to examine

Returns

maybePromise is Promise<any>

Whether it is a promise

Defined in

src/is-promise.js:7


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

index.js:23


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

NameTypeDescription
valuesIterable<T>An iterable of Promises.

Returns

Promise<Awaited<T>>

A new Promise.

Defined in

index.js:47