Skip to content

Commit

Permalink
first attempt at SoluteIO, phetsims/ph-scale#92
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jan 30, 2020
1 parent dda4865 commit fa2f709
Show file tree
Hide file tree
Showing 2 changed files with 160 additions and 3 deletions.
71 changes: 68 additions & 3 deletions js/phet-io/ph-scale-basics-phet-io-elements-baseline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,19 @@ window.phet.phetio.phetioElementsBaseline = assert &&
"phetioStudioControl": true,
"phetioTypeName": "NumberPropertyIO"
},
"phScaleBasics.macroScreen.model.dropper.soluteProperty": {
"phetioDocumentation": "",
"phetioDynamicElement": false,
"phetioEventType": "MODEL",
"phetioFeatured": false,
"phetioHighFrequency": false,
"phetioIsArchetype": false,
"phetioPlayback": false,
"phetioReadOnly": false,
"phetioState": true,
"phetioStudioControl": true,
"phetioTypeName": "PropertyIO<SoluteIO>"
},
"phScaleBasics.macroScreen.model.dropper.visibleProperty": {
"phetioDocumentation": "",
"phetioDynamicElement": false,
Expand Down Expand Up @@ -1509,6 +1522,19 @@ window.phet.phetio.phetioElementsBaseline = assert &&
"phetioStudioControl": true,
"phetioTypeName": "PropertyIO<NullableIO<NumberIO>>"
},
"phScaleBasics.macroScreen.model.solution": {
"phetioDocumentation": "",
"phetioDynamicElement": false,
"phetioEventType": "MODEL",
"phetioFeatured": false,
"phetioHighFrequency": false,
"phetioIsArchetype": false,
"phetioPlayback": false,
"phetioReadOnly": false,
"phetioState": false,
"phetioStudioControl": true,
"phetioTypeName": "ObjectIO"
},
"phScaleBasics.macroScreen.model.solution.pHProperty": {
"phetioDocumentation": "",
"phetioDynamicElement": false,
Expand All @@ -1522,7 +1548,7 @@ window.phet.phetio.phetioElementsBaseline = assert &&
"phetioStudioControl": true,
"phetioTypeName": "DerivedPropertyIO<NullableIO<NumberIO>>"
},
"phScaleBasics.macroScreen.model.solution.soluteVolumeProperty": {
"phScaleBasics.macroScreen.model.solution.soluteProperty": {
"phetioDocumentation": "",
"phetioDynamicElement": false,
"phetioEventType": "MODEL",
Expand All @@ -1533,10 +1559,23 @@ window.phet.phetio.phetioElementsBaseline = assert &&
"phetioReadOnly": true,
"phetioState": true,
"phetioStudioControl": true,
"phetioTypeName": "LinkedElementIO"
},
"phScaleBasics.macroScreen.model.solution.soluteVolumeProperty": {
"phetioDocumentation": "volume of solute in the solution",
"phetioDynamicElement": false,
"phetioEventType": "MODEL",
"phetioFeatured": false,
"phetioHighFrequency": false,
"phetioIsArchetype": false,
"phetioPlayback": false,
"phetioReadOnly": true,
"phetioState": true,
"phetioStudioControl": true,
"phetioTypeName": "NumberPropertyIO"
},
"phScaleBasics.macroScreen.model.solution.waterVolumeProperty": {
"phetioDocumentation": "",
"phScaleBasics.macroScreen.model.solution.volumeProperty": {
"phetioDocumentation": "total volume of the solution",
"phetioDynamicElement": false,
"phetioEventType": "MODEL",
"phetioFeatured": false,
Expand All @@ -1548,6 +1587,19 @@ window.phet.phetio.phetioElementsBaseline = assert &&
"phetioStudioControl": true,
"phetioTypeName": "DerivedPropertyIO<NumberIO>"
},
"phScaleBasics.macroScreen.model.solution.waterVolumeProperty": {
"phetioDocumentation": "volume of water in the solution",
"phetioDynamicElement": false,
"phetioEventType": "MODEL",
"phetioFeatured": false,
"phetioHighFrequency": false,
"phetioIsArchetype": false,
"phetioPlayback": false,
"phetioReadOnly": true,
"phetioState": true,
"phetioStudioControl": true,
"phetioTypeName": "NumberPropertyIO"
},
"phScaleBasics.macroScreen.model.waterFaucet.enabledProperty": {
"phetioDocumentation": "",
"phetioDynamicElement": false,
Expand Down Expand Up @@ -2536,6 +2588,19 @@ window.phet.phetio.phetioElementsBaseline = assert &&
"phetioStudioControl": true,
"phetioTypeName": "PropertyIO<NullableIO<BooleanIO>>"
},
"phScaleBasics.macroScreen.view.soluteComboBox.property": {
"phetioDocumentation": "",
"phetioDynamicElement": false,
"phetioEventType": "MODEL",
"phetioFeatured": false,
"phetioHighFrequency": false,
"phetioIsArchetype": false,
"phetioPlayback": false,
"phetioReadOnly": true,
"phetioState": true,
"phetioStudioControl": true,
"phetioTypeName": "LinkedElementIO"
},
"phScaleBasics.macroScreen.view.soluteComboBox.visibleProperty": {
"phetioDocumentation": "Controls whether the Node will be visible (and interactive), see the NodeIO documentation for more details.",
"phetioDynamicElement": false,
Expand Down
92 changes: 92 additions & 0 deletions js/phet-io/ph-scale-basics-phet-io-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,19 @@ window.phet.phetio.phetioTypes = assert &&
"supertype": "ObjectIO",
"typeName": "FunctionIO(ObjectIO)=>VoidIO"
},
"FunctionIO(SoluteIO,NullableIO<SoluteIO>)=>VoidIO": {
"documentation": "Wrapper for the built-in JS function type.<br><strong>Arguments:</strong> SoluteIO, NullableIO<SoluteIO><br><strong>Return Type:</strong> VoidIO",
"events": [],
"methodOrder": [],
"methods": {},
"parameterTypes": [
"SoluteIO",
"NullableIO<SoluteIO>",
"VoidIO"
],
"supertype": "ObjectIO",
"typeName": "FunctionIO(SoluteIO,NullableIO<SoluteIO>)=>VoidIO"
},
"FunctionIO(StringIO,NullableIO<StringIO>)=>VoidIO": {
"documentation": "Wrapper for the built-in JS function type.<br><strong>Arguments:</strong> StringIO, NullableIO<StringIO><br><strong>Return Type:</strong> VoidIO",
"events": [],
Expand Down Expand Up @@ -546,6 +559,14 @@ window.phet.phetio.phetioTypes = assert &&
"supertype": "ObjectIO",
"typeName": "FunctionIO(Vector2IO,NullableIO<Vector2IO>)=>VoidIO"
},
"LinkedElementIO": {
"documentation": "A LinkedElement",
"events": [],
"methodOrder": [],
"methods": {},
"supertype": "ObjectIO",
"typeName": "LinkedElementIO"
},
"NodeIO": {
"documentation": "The base type for graphical and potentially interactive objects. NodeIO has nested PropertyIO values for visibility, pickability and opacity.<br><br>Pickable can take one of three values:<br><ul><li>null: pass-through behavior. Nodes with input listeners are pickable, but nodes without input listeners won't block events for nodes behind it.</li><li>false: The node cannot be interacted with, and it blocks events for nodes behind it.</li><li>true: The node can be interacted with (if it has an input listener).</li></ul>For more about Scenery node pickability, please see <a href=\"http://phetsims.github.io/scenery/doc/implementation-notes#pickability\">http://phetsims.github.io/scenery/doc/implementation-notes#pickability</a>",
"events": [],
Expand Down Expand Up @@ -631,6 +652,17 @@ window.phet.phetio.phetioTypes = assert &&
"supertype": "ObjectIO",
"typeName": "NullableIO<SceneryEventIO>"
},
"NullableIO<SoluteIO>": {
"documentation": "A wrapper to wrap another IOType, adding support for null.",
"events": [],
"methodOrder": [],
"methods": {},
"parameterTypes": [
"SoluteIO"
],
"supertype": "ObjectIO",
"typeName": "NullableIO<SoluteIO>"
},
"NullableIO<StringIO>": {
"documentation": "A wrapper to wrap another IOType, adding support for null.",
"events": [],
Expand Down Expand Up @@ -1180,6 +1212,50 @@ window.phet.phetio.phetioTypes = assert &&
"supertype": "ObjectIO",
"typeName": "PropertyIO<NumberIO>"
},
"PropertyIO<SoluteIO>": {
"documentation": "Observable values that send out notifications when the value changes. This differs from the traditional listener pattern in that added listeners also receive a callback with the current value when the listeners are registered. This is a widely-used pattern in PhET-iO simulations.",
"events": [
"changed"
],
"methodOrder": [
"link",
"lazyLink"
],
"methods": {
"getValue": {
"documentation": "Gets the current value.",
"parameterTypes": [],
"returnType": "SoluteIO"
},
"lazyLink": {
"documentation": "Adds a listener which will be called when the value changes. This method is like \"link\", but without the current-value callback on registration. The listener takes two arguments, the new value and the previous value.",
"parameterTypes": [
"FunctionIO(SoluteIO,NullableIO<SoluteIO>)=>VoidIO"
],
"returnType": "VoidIO"
},
"link": {
"documentation": "Adds a listener which will be called when the value changes. On registration, the listener is also called with the current value. The listener takes two arguments, the new value and the previous value.",
"parameterTypes": [
"FunctionIO(SoluteIO,NullableIO<SoluteIO>)=>VoidIO"
],
"returnType": "VoidIO"
},
"setValue": {
"documentation": "Sets the value of the Property. If the value differs from the previous value, listeners are notified with the new value.",
"invocableForReadOnlyElements": false,
"parameterTypes": [
"SoluteIO"
],
"returnType": "VoidIO"
}
},
"parameterTypes": [
"SoluteIO"
],
"supertype": "ObjectIO",
"typeName": "PropertyIO<SoluteIO>"
},
"PropertyIO<StringIO>": {
"documentation": "Observable values that send out notifications when the value changes. This differs from the traditional listener pattern in that added listeners also receive a callback with the current value when the listeners are registered. This is a widely-used pattern in PhET-iO simulations.",
"events": [
Expand Down Expand Up @@ -1268,6 +1344,14 @@ window.phet.phetio.phetioTypes = assert &&
"supertype": "ObjectIO",
"typeName": "PropertyIO<Vector2IO>"
},
"ReferenceIO": {
"documentation": "Uses reference identity for toStateObject/fromStateObject",
"events": [],
"methodOrder": [],
"methods": {},
"supertype": "ObjectIO",
"typeName": "ReferenceIO"
},
"ResetAllButtonIO": {
"documentation": "Button that performs an action while it is being pressed, and stops the action when released",
"events": [
Expand Down Expand Up @@ -1308,6 +1392,14 @@ window.phet.phetio.phetioTypes = assert &&
"supertype": "ObjectIO",
"typeName": "SceneryEventIO"
},
"SoluteIO": {
"documentation": "the selected solute",
"events": [],
"methodOrder": [],
"methods": {},
"supertype": "ReferenceIO",
"typeName": "SoluteIO"
},
"StringIO": {
"documentation": "Wrapper for the built-in JS string type",
"events": [],
Expand Down

0 comments on commit fa2f709

Please sign in to comment.