Skip to content

DescriptionRegistry

Overview

Registry for all objects with a tandem/descriptionTandem set, for use by the description system.

NOTE: Experimental currently, see https://github.com/phetsims/joist/issues/941

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class DescriptionRegistry

import { DescriptionRegistry } from 'scenerystack/tandem';

Static Methods

add( tandem : Tandem, settable : Settable )

Called when a PhetioObject is created with a tandem, or when a tandem is set on a PhetioObject. Can also be called with a custom tandem that is not part of the PhET-iO API.

remove( settable : Settable )

Called when a PhetioObject is disposed, or when you want to remove a custom tandem that is not part of the PhET-iO API.

Static Properties

ENABLED

(readonly)

Feature flag, disabled until is ready for production, see https://github.com/phetsims/joist/issues/941

root : DescriptionEntry

(readonly)

Provides an object-structure matching the tandem hierarchy. On anything with a tandem with a matching PhetioObject, it will be set as the _value property. E.g. root.density.introScreen.model._value will be the IntroScreen object.

map : Map<TandemID, Settable>

(readonly)

Map from TandemID to the settable object, so we can find the object from a given tandemID. This will often be a PhetioObject, but may be other objects with a custom tandem (that are not part of the PhET-iO API).

addedEmitter : TinyEmitter

(readonly)

Emits with (tandemID, phetioObject) on PhetioObject addition/removal.

removedEmitter : TinyEmitter

(readonly)

Source Code

See the source for DescriptionRegistry.ts in the tandem repository.