Signals Playground

API

Your code runs with the proposal's Signal (the reference polyfill) and these helpers:

new Signal.State(v, { name })
A value you set. name labels it in the graph.
new Signal.Computed(fn, { name })
A value derived from what fn reads.
effect(fn, name?)
Runs fn now and again after anything it read changes, batched per microtask. Returns a stop function.
log(...values)
Writes to the console below the editor.
ui.button(label, fn)
A button.
ui.slider(label, state, { min, max, step })
A slider bound to a number State.
ui.text(label, state) · ui.toggle(label, state)
A text field or a checkbox bound to a State.
ui.show(label, signal)
Shows a signal's value, kept up to date.
setTimeout · setInterval
Stopped when the code runs again.

Select a node to set its value, see what it reads, and why it last re-ran.

Proposal ↗

Page

Console