Namespace: PhetioIDUtils

PhetioIDUtils

Helpful methods for manipulating phetioIDs. Used to minimize the amount of duplicated logic specific to the string structure of the phetioID. Available in the main PhET-iO js import.

Members

(static, constant) SEPARATOR :String

The separator used to piece together a phet-io id.
Type:
  • String

Methods

(static) append(phetioID, componentName) → {string}

Appends a component to an existing phetioID to create a new unique phetioID for the component. Example: append( 'myScreen.myControlPanel', 'myComboBox' ) -> 'myScreen.myControlPanel.myComboBox'
Parameters:
Name Type Description
phetioID string
componentName string
Returns:
Type
string

(static) getComponentName(phetioID) → {string}

Given a phetioID for a component (instance), get the part of that id that pertains to the component. Example: 'myScreen.myControlPanel.myComboBox' -> 'myComboBox'
Parameters:
Name Type Description
phetioID string
Returns:
Type
string

(static) getParentID(phetioID) → {string}

Given a phetioID for a component, get the phetioID of the parent component. Example: 'myScreen.myControlPanel.myComboBox' -> 'myScreen.myControlPanel'
Parameters:
Name Type Description
phetioID string
Returns:
Type
string