Skip to main content

@webda/coreReadme | API


Class: CancelablePromise<T>

Return a promise that can be cancelled

Extends

  • Promise<T>

Type parameters

T = void

Constructors

new CancelablePromise(callback, onCancel)

new CancelablePromise<T>(callback, onCancel): CancelablePromise<T>

Parameters

callback: (resolve, reject) => void= undefined

onCancel: () => Promise<void>= undefined

Returns

CancelablePromise<T>

Overrides

Promise<T>.constructor

Source

packages/core/src/utils/waiter.ts:140

Properties

[toStringTag]

readonly [toStringTag]: string

Inherited from

Promise.[toStringTag]

Source

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:176


cancel

cancel: () => Promise<void>

Returns

Promise<void>

Source

packages/core/src/utils/waiter.ts:139


[species]

static readonly [species]: PromiseConstructor

Inherited from

Promise.[species]

Source

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:180

Methods

catch()

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

Attaches a callback for only the rejection of the Promise.

Type parameters

TResult = never

Parameters

onrejected?: (reason) => 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

Source

node_modules/typescript/lib/lib.es5.d.ts:1556


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

onfinally?: () => 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

Source

node_modules/typescript/lib/lib.es2018.promise.d.ts:29


then()

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

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

Type parameters

TResult1 = T

TResult2 = never

Parameters

onfulfilled?: (value) => TResult1 | PromiseLike<TResult1>

The callback to execute when the Promise is resolved.

onrejected?: (reason) => 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

Source

node_modules/typescript/lib/lib.es5.d.ts:1549


all()

all(values)

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

T

Parameters

values: Iterable<T | PromiseLike<T>>

An iterable of Promises.

Returns

Promise<Awaited<T>[]>

A new Promise.

Inherited from

Promise.all

Source

node_modules/typescript/lib/lib.es2015.iterable.d.ts:225

all(values)

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

T extends [] | readonly unknown[]

Parameters

values: T

An array of Promises.

Returns

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

A new Promise.

Inherited from

Promise.all

Source

node_modules/typescript/lib/lib.es2015.promise.d.ts:39


allSettled()

allSettled(values)

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

T extends [] | readonly unknown[]

Parameters

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

Source

node_modules/typescript/lib/lib.es2020.promise.d.ts:38

allSettled(values)

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

T

Parameters

values: Iterable<T | PromiseLike<T>>

An array of Promises.

Returns

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

A new Promise.

Inherited from

Promise.allSettled

Source

node_modules/typescript/lib/lib.es2020.promise.d.ts:46


race()

race(values)

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

T

Parameters

values: Iterable<T | PromiseLike<T>>

An iterable of Promises.

Returns

Promise<Awaited<T>>

A new Promise.

Inherited from

Promise.race

Source

node_modules/typescript/lib/lib.es2015.iterable.d.ts:233

race(values)

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

T extends [] | readonly unknown[]

Parameters

values: T

An array of Promises.

Returns

Promise<Awaited<T[number]>>

A new Promise.

Inherited from

Promise.race

Source

node_modules/typescript/lib/lib.es2015.promise.d.ts:50


reject()

static reject<T>(reason?): Promise<T>

Creates a new rejected promise for the provided reason.

Type parameters

T = never

Parameters

reason?: any

The reason the promise was rejected.

Returns

Promise<T>

A new rejected Promise.

Inherited from

Promise.reject

Source

node_modules/typescript/lib/lib.es2015.promise.d.ts:60


resolve()

resolve()

static resolve(): Promise<void>

Creates a new resolved promise.

Returns

Promise<void>

A resolved promise.

Inherited from

Promise.resolve

Source

node_modules/typescript/lib/lib.es2015.promise.d.ts:66

resolve(value)

static resolve<T>(value): Promise<Awaited<T>>

Creates a new resolved promise for the provided value.

Type parameters

T

Parameters

value: T

A promise.

Returns

Promise<Awaited<T>>

A promise whose internal state matches the provided promise.

Inherited from

Promise.resolve

Source

node_modules/typescript/lib/lib.es2015.promise.d.ts:72

resolve(value)

static resolve<T>(value): Promise<Awaited<T>>

Creates a new resolved promise for the provided value.

Type parameters

T

Parameters

value: T | PromiseLike<T>

A promise.

Returns

Promise<Awaited<T>>

A promise whose internal state matches the provided promise.

Inherited from

Promise.resolve

Source

node_modules/typescript/lib/lib.es2015.promise.d.ts:78