Skip to main content

system

AnimationBus

Runtime infrastructure — publish-subscribe event bus enabling loose coupling between section animation lifecycle events.

The publish/subscribe bus every section and manager talks through. Sections
emit what they’re doing; LandingSequence and the managers listen and cue
the next step. No section holds a reference to another.

AnimationDirector creates one bus and injects it. There is no static API
and no global bus. A section constructed without one gets a
NullAnimationBus, so calling code never checks for a bus.

API

MethodDoes
on(event, callback)Subscribes. Returns a function that unsubscribes.
emit(event, data = {})Calls every listener for event with data.
off(event, callback)Removes one listener. Usually called through on’s return.
getListenerCount(event)Listener count, for finding leaks.
clearListeners(event?)Drops the listeners for one event, or for all when none given.

Event names come from EVENTS in events, never from a typed string.

Behaviour worth knowing

The three ways it’s used