Skip to main content

CancelableLoopPromise

@webda/core • Readme | API


Class: CancelableLoopPromise

Create a promise that will loop on the same callback until cancelled

Extends​

  • Promise<void>

Constructors​

new CancelableLoopPromise(callback, onCancel)​

new CancelableLoopPromise(callback, onCancel): CancelableLoopPromise

Parameters​

• callback: (canceller) => Promise<void>

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

Returns​

CancelableLoopPromise

Overrides​

Promise<void>.constructor

Source​

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

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:166

Accessors​

[species]​

get static [species](): PromiseConstructor

Returns​

PromiseConstructor

Source​

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

Methods​

catch()​

catch<TResult>(onrejected?): Promise<void | 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<void | TResult>

A Promise for the completion of the callback.

Inherited from​

Promise.catch

Source​

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


finally()​

finally(onfinally?): Promise<void>

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<void>

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 = void

• 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:1557


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>, any, any>

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:255

all(values)​

static all<T>(values): Promise<{ -readonly [P in string | number | symbol]: Awaited<T[P<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<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<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<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>, any, any>

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>, any, any>

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:263

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