@command
Marks a generator method as an editor-facing command, with labels, typed parameter metadata and duration defaults.
class Card extends LayoutActor {
@command({
label: "Reveal",
duration: { default: 0.4 },
})
*reveal() {
yield* this.appearance.opacity.tween(1, 0.4);
}
@command({
label: "Move To",
params: {
x: { kind: "number", label: "X" },
y: { kind: "number", label: "Y" },
},
duration: { default: 0.4 },
})
*moveTo({ x, y }: { x: number; y: number }, duration: number) {
yield* this.runtime.all(
this.layout.x.tween(x, duration),
this.layout.y.tween(y, duration),
);
}
}The decorator adds reflection metadata only. Methods without it work exactly the same when
called from code — @command is what makes them discoverable from an editor timeline or a
command palette.
Options
Prop
Type
Use it for
- Generator methods intended to be invoked from an editor timeline or command palette.
- Commands with meaningful default durations or typed parameters.
Do not use it for
- Business logic — the decorator does not change behaviour.
- Plain data fields. It decorates generator methods.
Reflection, not behaviour
compiled.reflect(frame) is what reads this metadata. Editors use it to render command
UI without knowing the actor's type; nothing in the resolution path consults it.