MotionScript

@motion-script/core


@motion-script/core / Context

Interface: Context<T>

Defined in: util/context.ts:14

Typed context tokens for passing inherited data down the node tree — analogous to React's createContext / useContext, but resolved over the scene-node tree rather than a render tree.

A Context is an opaque token carrying a phantom type T and a default value. Providers attach a value for a token to the ContextMap pushed to their descendants; a descendant reads the nearest ancestor's value (or the token's default) via node.useContext(token).

Mirrors the createRef factory style: a small typed helper rather than a class the author has to instantiate.

Type Parameters

T

T

Properties

defaultValue

readonly defaultValue: T

Defined in: util/context.ts:18

Value returned by useContext when no ancestor provides this token.


id

readonly id: symbol

Defined in: util/context.ts:16

Identity used as the map key. Unique per createContext call.


name?

readonly optional name?: string

Defined in: util/context.ts:20

Optional label, surfaced on the symbol for debugging.