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. 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:
GlobalPurpose
widgetRead and control widgets (reference)
wsSend and receive realtime messages (reference)
storagePersist small values on the client (reference)
dbQuery and insert database records (reference)
locationRead device geolocation (reference)
contextProduct, device, and user info (reference)
sensorProduct sensor helpers
usbProduct USB helpers
pdfPDF export helpers
consoleLogging — output appears in the script console
fetchStandard fetch for HTTP requests
setTimeout / setIntervalStandard timers

A first script

// Update a label when a slider changes
widget.on('brightnessSlider', 'change', (value) => {
  widget.setText('brightnessLabel', `Brightness: ${value}%`);
});

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.