Skip to main content

Class: MiniPromise<T>

@evolv/react.MiniPromise

Type parameters​

NameType
Tany

Hierarchy​

  • Promise<T>

    ↳ MiniPromise

Constructors​

constructor​

• new MiniPromise<T>(executor)

Creates a new Promise.

Type parameters​

NameType
Tany

Parameters​

NameTypeDescription
executor(resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => voidA callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or error.

Inherited from​

Promise<T>.constructor

Properties​

[toStringTag]​

• Readonly [toStringTag]: string

Inherited from​

Promise.__@toStringTag@142


[species]​

▪ Static Readonly [species]: PromiseConstructor

Inherited from​

Promise.__@species@6724

Methods​

catch​

▸ catch<TResult>(onrejected?): Promise<T | TResult>

Attaches a callback for only the rejection of the Promise.

Type parameters​

NameType
TResultnever

Parameters​

NameTypeDescription
onrejected?null | (reason: any) => TResult | PromiseLike<TResult>The callback to execute when the Promise is rejected.

Returns​

Promise<T | TResult>

A Promise for the completion of the callback.

Inherited from​

Promise.catch


finally​

▸ finally(onfinally?): Promise<T>

Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

Parameters​

NameTypeDescription
onfinally?null | () => voidThe callback to execute when the Promise is settled (fulfilled or rejected).

Returns​

Promise<T>

A Promise for the completion of the callback.

Inherited from​

Promise.finally


then​

▸ then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>

Attaches callbacks for the resolution and/or rejection of the Promise.

Type parameters​

NameType
TResult1T
TResult2never

Parameters​

NameTypeDescription
onfulfilled?null | (value: T) => TResult1 | PromiseLike<TResult1>The callback to execute when the Promise is resolved.
onrejected?null | (reason: any) => TResult2 | PromiseLike<TResult2>The callback to execute when the Promise is rejected.

Returns​

Promise<TResult1 | TResult2>

A Promise for the completion of which ever callback is executed.

Inherited from​

Promise.then


all​

▸ Static all<T>(values): Promise<Awaited<T>[]>

Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

Type parameters​

Name
T

Parameters​

NameTypeDescription
valuesIterable<T | PromiseLike<T>>An iterable of Promises.

Returns​

Promise<Awaited<T>[]>

A new Promise.

Inherited from​

Promise.all

▸ Static all<T>(values): Promise<{ -readonly [P in string | number | symbol]: Awaited<T[P]> }>

Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.

Type parameters​

NameType
Textends readonly unknown[] | []

Parameters​

NameTypeDescription
valuesTAn array of Promises.

Returns​

Promise<{ -readonly [P in string | number | symbol]: Awaited<T[P]> }>

A new Promise.

Inherited from​

Promise.all


allSettled​

▸ Static allSettled<T>(values): Promise<{ -readonly [P in string | number | symbol]: PromiseSettledResult<Awaited<T[P]>> }>

Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.

Type parameters​

NameType
Textends readonly unknown[] | []

Parameters​

NameTypeDescription
valuesTAn array of Promises.

Returns​

Promise<{ -readonly [P in string | number | symbol]: PromiseSettledResult<Awaited<T[P]>> }>

A new Promise.

Inherited from​

Promise.allSettled

▸ Static allSettled<T>(values): Promise<PromiseSettledResult<Awaited<T>>[]>

Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.

Type parameters​

Name
T

Parameters​

NameTypeDescription
valuesIterable<T | PromiseLike<T>>An array of Promises.

Returns​

Promise<PromiseSettledResult<Awaited<T>>[]>

A new Promise.

Inherited from​

Promise.allSettled


any​

▸ Static any<T>(values): Promise<Awaited<T[number]>>

The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.

Type parameters​

NameType
Textends readonly unknown[] | []

Parameters​

NameTypeDescription
valuesTAn array or iterable of Promises.

Returns​

Promise<Awaited<T[number]>>

A new Promise.

Inherited from​

Promise.any

▸ Static any<T>(values): Promise<Awaited<T>>

The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.

Type parameters​

Name
T

Parameters​

NameTypeDescription
valuesIterable<T | PromiseLike<T>>An array or iterable of Promises.

Returns​

Promise<Awaited<T>>

A new Promise.

Inherited from​

Promise.any


createPromise​

▸ Static createPromise<T>(executor): MiniPromise<T>

Type parameters​

Name
T

Parameters​

NameType
executor(resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void

Returns​

MiniPromise<T>


race​

▸ Static race<T>(values): Promise<Awaited<T>>

Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.

Type parameters​

Name
T

Parameters​

NameTypeDescription
valuesIterable<T | PromiseLike<T>>An iterable of Promises.

Returns​

Promise<Awaited<T>>

A new Promise.

Inherited from​

Promise.race

▸ Static race<T>(values): Promise<Awaited<T[number]>>

Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.

Type parameters​

NameType
Textends readonly unknown[] | []

Parameters​

NameTypeDescription
valuesTAn array of Promises.

Returns​

Promise<Awaited<T[number]>>

A new Promise.

Inherited from​

Promise.race


reject​

▸ Static reject<T>(reason?): Promise<T>

Creates a new rejected promise for the provided reason.

Type parameters​

NameType
Tnever

Parameters​

NameTypeDescription
reason?anyThe reason the promise was rejected.

Returns​

Promise<T>

A new rejected Promise.

Inherited from​

Promise.reject


resolve​

▸ Static resolve(): Promise<void>

Creates a new resolved promise.

Returns​

Promise<void>

A resolved promise.

Inherited from​

Promise.resolve

▸ Static resolve<T>(value): Promise<T>

Creates a new resolved promise for the provided value.

Type parameters​

Name
T

Parameters​

NameTypeDescription
valueT | PromiseLike<T>A promise.

Returns​

Promise<T>

A promise whose internal state matches the provided promise.

Inherited from​

Promise.resolve