ComponentHandler
File: Rhapsodist/Core/Includes/ComponentHandler.js · Namespace: ComponentHandler
Overview
ComponentHandler applies declarative component property changes from the Manifest when the patch or articulation changes, hiding/showing a control, changing a label’s text, and so on.
It’s enabled by adding a components array ({id, properties} objects) to a Manifest patch or articulation entry; see the schema in The Manifest.
A value property is special-cased: it goes through the component’s normal value-change path (setValue + changed()), so it also fires that component’s own control callback and any listening broadcasters. Every other property is set directly.
Patch-level components are applied first, then articulation-level, so articulation settings win if both set the same property.
Usage
ComponentHandler wires itself up as soon as Core.js is included, there’s nothing to call directly. Add a components array to a Manifest patch or articulation entry and it applies automatically whenever that patch or articulation becomes active.
Internal Reference
| Function | Description | Returns |
|---|---|---|
getAllComponentsIndexed() | Builds a lookup of every component on the interface, keyed by ID. Used to resolve a Manifest entry’s id to its component. | object |
setComponentProperties(data: Array) | Applies a {id, properties} array from the Manifest to the matching components, special-casing value so it goes through setValue/changed(). | — |
Broadcasters
| Broadcaster | Description |
|---|---|
bcPatchChanged | Fires when knbPatch changes value. Applies the Manifest’s top-level components array, then the new patch’s own components array, via setComponentProperties(). |
bcArticulationChanged | Fires when knbArticulation changes value. Re-applies the current patch’s components array, then the matching articulation’s own components array. |