Skip to main content
The Script tab lets you add JavaScript logic to a dashboard — react to widget changes, talk over the realtime channel, read and write the database, and more. The script runs once, when the dashboard loads. Everything reactive happens through the listeners you register in it (widget.on, ws.onMessage, timers) — so the typical shape is: set up state, register handlers, done. Your code runs in a sandboxed context with a fixed set of globals.

The sandbox globals

Your script is executed with these variables already in scope — you don’t import anything:

A first script

Fetch & timers

fetch is the standard Fetch API — call external HTTP APIs directly from a script:
setTimeout / setInterval are the standard timers. Keep interval handles so you can clear them:
console.log/warn/error/info output appears in the script console panel below the editor — your main debugging tool.

When to use scripts

  • Glue logic between widgets — when one changes, update another
  • Custom realtime handling — interpret incoming device messages your own way
  • Client-side persistence — remember a user’s last choice
  • Data-driven UI — query the database and render the result

widget

Values, text, visibility, layout, config, events.

ws

Realtime send / receive.

db

Query and insert records.

Events

The full widget event vocabulary.