Skip to content

CancellablePromise

Defined in: src/pattern/after.ts:9

Wait for delayMs, then execute factory() and return its eventual value. The delay is cancellable via the returned Promise’s .cancel() method — useful for building retry/timeout helpers.

factory is called once after the delay; if you need to re-evaluate on each retry, pass a function that returns a fresh Promise each time.

  • Promise<T>

T

readonly [toStringTag]: string

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

Promise.[toStringTag]

cancel(): void

Defined in: src/pattern/after.ts:10

void


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

Defined in: docs/node_modules/typescript/lib/lib.es5.d.ts:1564

Attaches a callback for only the rejection of the Promise.

TResult = never

((reason) => TResult | PromiseLike<TResult>) | null

The callback to execute when the Promise is rejected.

Promise<T | TResult>

A Promise for the completion of the callback.

Promise.catch


finally(onfinally?): Promise<T>

Defined in: docs/node_modules/typescript/lib/lib.es2018.promise.d.ts:29

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

(() => void) | null

The callback to execute when the Promise is settled (fulfilled or rejected).

Promise<T>

A Promise for the completion of the callback.

Promise.finally


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

Defined in: docs/node_modules/typescript/lib/lib.es5.d.ts:1557

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

TResult1 = T

TResult2 = never

((value) => TResult1 | PromiseLike<TResult1>) | null

The callback to execute when the Promise is resolved.

((reason) => TResult2 | PromiseLike<TResult2>) | null

The callback to execute when the Promise is rejected.

Promise<TResult1 | TResult2>

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

Promise.then