Skip to content

Documentation / @ripl/core / Transition

Class: Transition ​

Defined in: packages/core/src/animation/transition.ts:43

A Task-based animation that drives a callback over time with easing, looping, and abort support.

Extends ​

Constructors ​

Constructor ​

new Transition(executor, hooks?): Transition

Defined in: packages/core/src/animation/transition.ts:51

Parameters ​

ParameterType
executorTaskExecutor<void>
hooks?TransitionHooks

Returns ​

Transition

Overrides ​

Task.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
[toStringTag]readonlystring-Task.[toStringTag]node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:176
inversepublic() => TransitionA factory function that creates a new Transition running in the opposite direction. Set by the transition mechanism that created this instance.-packages/core/src/animation/transition.ts:49
[species]readonlyPromiseConstructor-Task.[species]node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:180

Accessors ​

hasAborted ​

Get Signature ​

get hasAborted(): boolean

Defined in: packages/core/src/task/index.ts:102

Whether this task has already been aborted.

Returns ​

boolean

Inherited from ​

Task.hasAborted


paused ​

Get Signature ​

get paused(): boolean

Defined in: packages/core/src/animation/transition.ts:57

Whether the transition is currently paused.

Returns ​

boolean


signal ​

Get Signature ​

get signal(): AbortSignal

Defined in: packages/core/src/task/index.ts:97

The AbortSignal associated with this task's controller.

Returns ​

AbortSignal

Inherited from ​

Task.signal

Methods ​

abort() ​

abort(reason?): this

Defined in: packages/core/src/task/index.ts:107

Aborts the task with an optional reason, triggering all registered abort callbacks.

Parameters ​

ParameterType
reason?unknown

Returns ​

this

Inherited from ​

Task.abort


catch() ​

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

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

Attaches a callback for only the rejection of the Promise.

Type Parameters ​

Type ParameterDefault type
TResultnever

Parameters ​

ParameterTypeDescription
onrejected?(reason) => TResult | PromiseLike<TResult> | nullThe callback to execute when the Promise is rejected.

Returns ​

Promise<void | TResult>

A Promise for the completion of the callback.

Inherited from ​

Task.catch


finally() ​

finally(onfinally?): Promise<void>

Defined in: 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.

Parameters ​

ParameterTypeDescription
onfinally?() => void | nullThe callback to execute when the Promise is settled (fulfilled or rejected).

Returns ​

Promise<void>

A Promise for the completion of the callback.

Inherited from ​

Task.finally


pause() ​

pause(): this

Defined in: packages/core/src/animation/transition.ts:62

Pauses the transition without resolving the promise.

Returns ​

this


play() ​

play(): this

Defined in: packages/core/src/animation/transition.ts:72

Resumes a paused transition from where it left off.

Returns ​

this


seek() ​

seek(position): this

Defined in: packages/core/src/animation/transition.ts:82

Seeks to a normalised position (0–1) and pauses.

Parameters ​

ParameterType
positionnumber

Returns ​

this


then() ​

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

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

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

Type Parameters ​

Type ParameterDefault type
TResult1void
TResult2never

Parameters ​

ParameterTypeDescription
onfulfilled?(value) => TResult1 | PromiseLike<TResult1> | nullThe callback to execute when the Promise is resolved.
onrejected?(reason) => TResult2 | PromiseLike<TResult2> | nullThe 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 ​

Task.then


all() ​

Call Signature ​

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

Defined in: node_modules/typescript/lib/lib.es2015.iterable.d.ts:255

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 ​
Type Parameter
T
Parameters ​
ParameterTypeDescription
valuesIterable<T | PromiseLike<T>>An iterable of Promises.
Returns ​

Promise<Awaited<T>[]>

A new Promise.

Inherited from ​

Task.all

Call Signature ​

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

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

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 ​
Type Parameter
T extends [] | readonly unknown[]
Parameters ​
ParameterTypeDescription
valuesTAn array of Promises.
Returns ​

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

A new Promise.

Inherited from ​

Task.all


allSettled() ​

Call Signature ​

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

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

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

Type Parameters ​
Type Parameter
T extends [] | readonly unknown[]
Parameters ​
ParameterTypeDescription
valuesTAn array of Promises.
Returns ​

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

A new Promise.

Inherited from ​

Task.allSettled

Call Signature ​

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

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

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

Type Parameters ​
Type Parameter
T
Parameters ​
ParameterTypeDescription
valuesIterable<T | PromiseLike<T>>An array of Promises.
Returns ​

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

A new Promise.

Inherited from ​

Task.allSettled


any() ​

Call Signature ​

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

Defined in: node_modules/typescript/lib/lib.es2021.promise.d.ts:40

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 ​
Type Parameter
T extends [] | readonly unknown[]
Parameters ​
ParameterTypeDescription
valuesTAn array or iterable of Promises.
Returns ​

Promise<Awaited<T[number]>>

A new Promise.

Inherited from ​

Task.any

Call Signature ​

static any<T>(values): Promise<Awaited<T>>

Defined in: node_modules/typescript/lib/lib.es2021.promise.d.ts:47

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 ​
Type Parameter
T
Parameters ​
ParameterTypeDescription
valuesIterable<T | PromiseLike<T>>An array or iterable of Promises.
Returns ​

Promise<Awaited<T>>

A new Promise.

Inherited from ​

Task.any


race() ​

Call Signature ​

static race<T>(values): Promise<Awaited<T>>

Defined in: node_modules/typescript/lib/lib.es2015.iterable.d.ts:263

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

Type Parameters ​
Type Parameter
T
Parameters ​
ParameterTypeDescription
valuesIterable<T | PromiseLike<T>>An iterable of Promises.
Returns ​

Promise<Awaited<T>>

A new Promise.

Inherited from ​

Task.race

Call Signature ​

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

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

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

Type Parameters ​
Type Parameter
T extends [] | readonly unknown[]
Parameters ​
ParameterTypeDescription
valuesTAn array of Promises.
Returns ​

Promise<Awaited<T[number]>>

A new Promise.

Inherited from ​

Task.race


reject() ​

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

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

Creates a new rejected promise for the provided reason.

Type Parameters ​

Type ParameterDefault type
Tnever

Parameters ​

ParameterTypeDescription
reason?anyThe reason the promise was rejected.

Returns ​

Promise<T>

A new rejected Promise.

Inherited from ​

Task.reject


resolve() ​

Call Signature ​

static resolve(): Promise<void>

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

Creates a new resolved promise.

Returns ​

Promise<void>

A resolved promise.

Inherited from ​

Task.resolve

Call Signature ​

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

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

Creates a new resolved promise for the provided value.

Type Parameters ​
Type Parameter
T
Parameters ​
ParameterTypeDescription
valueTA promise.
Returns ​

Promise<Awaited<T>>

A promise whose internal state matches the provided promise.

Inherited from ​

Task.resolve

Call Signature ​

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

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

Creates a new resolved promise for the provided value.

Type Parameters ​
Type Parameter
T
Parameters ​
ParameterTypeDescription
valueT | PromiseLike<T>A promise.
Returns ​

Promise<Awaited<T>>

A promise whose internal state matches the provided promise.

Inherited from ​

Task.resolve


try() ​

static try<T, U>(callbackFn, ...args): Promise<Awaited<T>>

Defined in: node_modules/typescript/lib/lib.esnext.promise.d.ts:33

Takes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result in a Promise.

Type Parameters ​

Type Parameter
T
U extends unknown[]

Parameters ​

ParameterTypeDescription
callbackFn(...args) => T | PromiseLike<T>A function that is called synchronously. It can do anything: either return a value, throw an error, or return a promise.
...argsUAdditional arguments, that will be passed to the callback.

Returns ​

Promise<Awaited<T>>

A Promise that is:

  • Already fulfilled, if the callback synchronously returns a value.
  • Already rejected, if the callback synchronously throws an error.
  • Asynchronously fulfilled or rejected, if the callback returns a promise.

Inherited from ​

Task.try


withResolvers() ​

static withResolvers<T>(): PromiseWithResolvers<T>

Defined in: node_modules/typescript/lib/lib.es2024.promise.d.ts:34

Creates a new Promise and returns it in an object, along with its resolve and reject functions.

Type Parameters ​

Type Parameter
T

Returns ​

PromiseWithResolvers<T>

An object with the properties promise, resolve, and reject.

ts
const { promise, resolve, reject } = Promise.withResolvers<T>();

Inherited from ​

Task.withResolvers