Class: MiniPromise<T>
@evolv/nextjs.MiniPromise
Type parameters
| Name | Type |
|---|---|
T | any |
Hierarchy
-
Promise<T>↳
MiniPromise
Constructors
constructor
• new MiniPromise<T>(executor)
Creates a new Promise.
Type parameters
| Name | Type |
|---|---|
T | any |
Parameters
| Name | Type | Description |
|---|---|---|
executor | (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void | A 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@5477
[species]
▪ Static Readonly [species]: PromiseConstructor
Inherited from
Promise.__@species@6103
Methods
catch
▸ catch<TResult>(onrejected?): Promise<T | TResult>
Attaches a callback for only the rejection of the Promise.
Type parameters
| Name | Type |
|---|---|
TResult | never |
Parameters
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
onfinally? | null | () => void | The 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
| Name | Type |
|---|---|
TResult1 | T |
TResult2 | never |
Parameters
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
values | Iterable<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
| Name | Type |
|---|---|
T | extends [] | readonly unknown[] |
Parameters
| Name | Type | Description |
|---|---|---|
values | T | An 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
| Name | Type |
|---|---|
T | extends [] | readonly unknown[] |
Parameters
| Name | Type | Description |
|---|---|---|
values | T | An 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
| Name | Type | Description |
|---|---|---|
values | Iterable<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
| Name | Type |
|---|---|
T | extends [] | readonly unknown[] |
Parameters
| Name | Type | Description |
|---|---|---|
values | T | An 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
| Name | Type | Description |
|---|---|---|
values | Iterable<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
| Name | Type |
|---|---|
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
| Name | Type | Description |
|---|---|---|
values | Iterable<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
| Name | Type |
|---|---|
T | extends [] | readonly unknown[] |
Parameters
| Name | Type | Description |
|---|---|---|
values | T | An 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
| Name | Type |
|---|---|
T | never |
Parameters
| Name | Type | Description |
|---|---|---|
reason? | any | The 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
| Name | Type | Description |
|---|---|---|
value | T | PromiseLike<T> | A promise. |
Returns
Promise<T>
A promise whose internal state matches the provided promise.
Inherited from
Promise.resolve