Skip to content

Watcher

An on-stage readout that displays the live value of a variable or expression, like the score box in the corner of a game. It updates automatically as the value it watches changes.

The Watcher engine class. Most members are available as free functions; this page documents the underlying API for advanced use.

Watcher.height: number | undefined

The watcher’s height in stage units, or undefined to size automatically.

Since 1.0.0

Watcher.label: string

The text label shown next to the watcher’s value on the stage.

Since 1.0.0

Watcher.max: number

The largest value the slider style watcher allows.

Since 1.0.0

Watcher.min: number

The smallest value the slider style watcher allows.

Since 1.0.0

Watcher.setValue: (value: number) => void

Function that updates the underlying variable when the slider is dragged.

Since 1.0.0

Watcher.step: number

How much the slider value changes with each step.

Since 1.0.0

Watcher.style: WatcherStyle

How the watcher looks on the stage: “normal”, “large”, or “slider”.

Since 1.0.0

Watcher.updateDOM(renderTarget: HTMLElement | null): void

Refreshes the watcher’s on-screen display to match the current value.

Since 1.0.0

Watcher.value: () => WatcherValue

Function that returns the current value to display on the stage.

Since 1.0.0

Watcher.visible: boolean

Whether the watcher is shown on the stage.

Since 1.0.0

Watcher.width: number | undefined

The watcher’s width in stage units, or undefined to size automatically.

Since 1.0.0

Watcher.x: number

The watcher’s horizontal position on the stage.

Since 1.0.0

Watcher.y: number

The watcher’s vertical position on the stage.

Since 1.0.0