Skip to content

Commit

Permalink
Move PropertyIO to Property.js, see phetsims/tandem#212
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Sep 29, 2020
1 parent 4a4d193 commit 4a7dd57
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
3 changes: 1 addition & 2 deletions js/common/model/Battery.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import NumberProperty from '../../../../axon/js/NumberProperty.js';
import Property from '../../../../axon/js/Property.js';
import PropertyIO from '../../../../axon/js/PropertyIO.js';
import Dimension2 from '../../../../dot/js/Dimension2.js';
import Vector3 from '../../../../dot/js/Vector3.js';
import EnumerationIO from '../../../../phet-core/js/EnumerationIO.js';
Expand Down Expand Up @@ -65,7 +64,7 @@ function Battery( position, voltage, modelViewTransform, tandem ) {
this.polarityProperty = new Property( CapacitorConstants.POLARITY.POSITIVE, {
validValues: CapacitorConstants.POLARITY.VALUES,
tandem: tandem.createTandem( 'polarityProperty' ),
phetioType: PropertyIO( EnumerationIO( CapacitorConstants.POLARITY ) )
phetioType: Property.PropertyIO( EnumerationIO( CapacitorConstants.POLARITY ) )
} );

const self = this;
Expand Down
3 changes: 1 addition & 2 deletions js/common/model/CLBModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Emitter from '../../../../axon/js/Emitter.js';
import EnumerationProperty from '../../../../axon/js/EnumerationProperty.js';
import NumberProperty from '../../../../axon/js/NumberProperty.js';
import Property from '../../../../axon/js/Property.js';
import PropertyIO from '../../../../axon/js/PropertyIO.js';
import Dimension2 from '../../../../dot/js/Dimension2.js';
import inherit from '../../../../phet-core/js/inherit.js';
import CapacitorConstants from '../../../../scenery-phet/js/capacitor/CapacitorConstants.js';
Expand Down Expand Up @@ -93,7 +92,7 @@ function CLBModel( switchUsedProperty, modelViewTransform, tandem ) {
// @public {Property.<Color>}
this.arrowColorProperty = new Property( new Color( 83, 200, 236 ), {
tandem: tandem.createTandem( 'arrowColorProperty' ),
phetioType: PropertyIO( ColorIO )
phetioType: Property.PropertyIO( ColorIO )
} );

// @public {Property.<boolean>} Whether the sim is paused
Expand Down
3 changes: 1 addition & 2 deletions js/common/model/Capacitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import DerivedProperty from '../../../../axon/js/DerivedProperty.js';
import NumberProperty from '../../../../axon/js/NumberProperty.js';
import Property from '../../../../axon/js/Property.js';
import PropertyIO from '../../../../axon/js/PropertyIO.js';
import Bounds3 from '../../../../dot/js/Bounds3.js';
import Bounds3IO from '../../../../dot/js/Bounds3IO.js';
import Vector3 from '../../../../dot/js/Vector3.js';
Expand Down Expand Up @@ -74,7 +73,7 @@ function Capacitor( config, circuitConnectionProperty, tandem, options ) {
// @public {Property.<Bounds3>}
this.plateSizeProperty = new Property( plateBounds, {
tandem: tandem.createTandem( 'plateSizeProperty' ),
phetioType: PropertyIO( Bounds3IO ),
phetioType: Property.PropertyIO( Bounds3IO ),
phetioReadOnly: true
} );

Expand Down
3 changes: 1 addition & 2 deletions js/common/model/ParallelCircuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import NumberProperty from '../../../../axon/js/NumberProperty.js';
import Property from '../../../../axon/js/Property.js';
import PropertyIO from '../../../../axon/js/PropertyIO.js';
import Shape from '../../../../kite/js/Shape.js';
import inherit from '../../../../phet-core/js/inherit.js';
import StringIO from '../../../../tandem/js/types/StringIO.js';
Expand Down Expand Up @@ -48,7 +47,7 @@ function ParallelCircuit( config, tandem ) {
// @public {Property.<CircuitState>} - Property tracking the state of the switch
this.circuitConnectionProperty = new Property( CircuitState.BATTERY_CONNECTED, {
tandem: tandem.createTandem( 'circuitConnectionProperty' ),
phetioType: PropertyIO( StringIO ),
phetioType: Property.PropertyIO( StringIO ),
validValues: CircuitState.VALUES
} );

Expand Down
13 changes: 6 additions & 7 deletions js/common/model/meter/Voltmeter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import BooleanProperty from '../../../../../axon/js/BooleanProperty.js';
import Property from '../../../../../axon/js/Property.js';
import PropertyIO from '../../../../../axon/js/PropertyIO.js';
import Bounds2 from '../../../../../dot/js/Bounds2.js';
import Dimension2 from '../../../../../dot/js/Dimension2.js';
import Vector3 from '../../../../../dot/js/Vector3.js';
Expand Down Expand Up @@ -74,21 +73,21 @@ function Voltmeter( circuit, dragBounds, modelViewTransform, voltmeterVisiblePro
this.bodyPositionProperty = new Property( new Vector3( 0, 0, 0 ), {
useDeepEquality: true,
tandem: tandem.createTandem( 'bodyPositionProperty' ),
phetioType: PropertyIO( Vector3IO )
phetioType: Property.PropertyIO( Vector3IO )
} );

// @public {Property.<Vector3>}
this.positiveProbePositionProperty = new Property( POSITIVE_PROBE_POSITION, {
useDeepEquality: true,
tandem: tandem.createTandem( 'positiveProbePositionProperty' ),
phetioType: PropertyIO( Vector3IO )
phetioType: Property.PropertyIO( Vector3IO )
} );

// @public {Property.<Vector3>}
this.negativeProbePositionProperty = new Property( NEGATIVE_PROBE_POSITION, {
useDeepEquality: true,
tandem: tandem.createTandem( 'negativeProbePositionProperty' ),
phetioType: PropertyIO( Vector3IO )
phetioType: Property.PropertyIO( Vector3IO )
} );

// By design, the voltmeter reads "?" for disconnected contacts, which is represented internally by a null
Expand All @@ -97,20 +96,20 @@ function Voltmeter( circuit, dragBounds, modelViewTransform, voltmeterVisiblePro
this.measuredVoltageProperty = new Property( null, {
tandem: tandem.createTandem( 'measuredVoltageProperty' ),
units: 'volts',
phetioType: PropertyIO( NullableIO( NumberIO ) )
phetioType: Property.PropertyIO( NullableIO( NumberIO ) )
} );

// TODO: factor out shared code for positive/negative probe
// @private {Property.<ProbeTarget>} - What the positive probe is currently touching. Updated from within computeValue below.
this.positiveProbeTargetProperty = new Property( ProbeTarget.NONE, {
tandem: tandem.createTandem( 'positiveProbeTargetProperty' ),
phetioType: PropertyIO( StringIO )
phetioType: Property.PropertyIO( StringIO )
} );

// @private {Property.<ProbeTarget>} - What the negative probe is currently touching. Updated from within computeValue below.
this.negativeProbeTargetProperty = new Property( ProbeTarget.NONE, {
tandem: tandem.createTandem( 'negativeProbeTargetProperty' ),
phetioType: PropertyIO( StringIO )
phetioType: Property.PropertyIO( StringIO )
} );

const self = this;
Expand Down

0 comments on commit 4a7dd57

Please sign in to comment.