Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

FunctionDescriptionReturns
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

BroadcasterDescription
bcPatchChangedFires when knbPatch changes value. Applies the Manifest’s top-level components array, then the new patch’s own components array, via setComponentProperties().
bcArticulationChangedFires when knbArticulation changes value. Re-applies the current patch’s components array, then the matching articulation’s own components array.