Skip to content

map.toml: [lifecycle]

The optional lifecycle hooks: on_init, on_shutdown, idle_heartbeat, and their session semantics.

[lifecycle] names functions implemented in script.rhai.

Keys

Key Required When it runs
on_init no Runs once when the session starts (attach, reconnect). After the hook returns, the session force-refreshes every LED, re-asserting each lamp.
on_shutdown no Runs once when the session shuts down (detach, shutdown). After the hook returns, the session clears every mapped lamp.
idle_heartbeat no Called periodically, roughly once per second, and only while no deck is playing.

All three are optional, but any of them requires the bundle to contain script.rhai; otherwise load fails with [lifecycle] requires script.rhai in the mapping bundle. Each name must be non-empty. See Scripts for the hook signatures and what they can do.

[lifecycle]
on_init = "on_init"
idle_heartbeat = "idle_heartbeat"
on_shutdown = "on_shutdown"
  • Scripts: the Rhai hooks, sandbox limits, and error reporting.
  • outputs: the declarative LED state the session forces around these hooks.
  • map.toml: the overview for the file as a whole.