Log inGet started
World

The Eighth Ketyl

Branchmain
Branchesmain
Commite99ff0a216

README.md

staging.Bus

One armed set of listeners on the shared event bus, for the staging slice.

local Bus = require("staging.Bus")
Bus.arm({ plateCleared = function(n) ... end, sealed = function() ... end })
Bus.disarm()
Bus.count()   -- how many are armed right now

A component's init.luau is re-executed on every hot reload, and the reload does not fire onDestroy: the previous chunk's module-level locals come back empty while its closures are still subscribed. Left alone, the staging director would end up with two of every listener after two edits, and a plate going clean would play its beat twice.

Holding the subscriptions here fixes that. This module is edited far less often than the director it serves, so its state survives the director's reloads, and arm drops whatever it was holding before it takes the new set.