Skip to content

Function: control()

control<T>(spec): ControlBox<T>

Defined in: control.ts:205

Declare one control. Returns the two-way box widgets bind and cells read — reads are recorded as dependency edges when they happen inside a cell's deps; writes are validated against the meta in ONE place:

  • wrong type (vs. the initial value's type) → throws;
  • outside options (when given) → throws;
  • outside min/max → clamped; off-step → snapped.
ts
/** Diffusion constant — how fast heat spreads. */
export const kappa = control({ value: 0.1, min: 0.01, max: 1, step: 0.01 });
kappa.get();     // read (edge-recorded inside cell deps)
kappa.set(2);    // → clamped to 1

Type Parameters

T

T

Parameters

spec

ControlSpec<T>

Returns

ControlBox<T>