Skip to content

Commit

Permalink
reformat calls to DerivedProperty constructors #210
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Oct 12, 2017
1 parent 02dbf8a commit 7b4b1ff
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions js/concentration/model/ConcentrationSolution.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ define( function( require ) {
);

// @public boolean property indicating whether the solution is saturated or not.
this.saturatedProperty = new DerivedProperty( [ this.soluteProperty, this.soluteAmountProperty, this.volumeProperty ],
this.saturatedProperty = new DerivedProperty(
[ this.soluteProperty, this.soluteAmountProperty, this.volumeProperty ],
function( solute, soluteAmount, volume ) {
return ( volume > 0 ) && ( soluteAmount / volume ) > solute.getSaturatedConcentration();
}, {
Expand All @@ -91,7 +92,8 @@ define( function( require ) {
);

// @public {number} amount of solute, in grams
this.soluteGramsProperty = new DerivedProperty( [ this.soluteProperty, this.soluteAmountProperty, this.precipitateAmountProperty ],
this.soluteGramsProperty = new DerivedProperty(
[ this.soluteProperty, this.soluteAmountProperty, this.precipitateAmountProperty ],
function( solute, soluteAmount, precipitateAmount ) {
var soluteGrams = solute.molarMass * ( soluteAmount - precipitateAmount );
assert && assert( soluteGrams >= 0, 'invalid soluteGrams: ' + soluteGrams );
Expand All @@ -104,7 +106,8 @@ define( function( require ) {
);

// @public {number} percent concentration [0,100]
this.percentConcentrationProperty = new DerivedProperty( [ this.volumeProperty, this.soluteGramsProperty ],
this.percentConcentrationProperty = new DerivedProperty(
[ this.volumeProperty, this.soluteGramsProperty ],
function( volume, soluteGrams ) {
var percentConcentration = 0;
if ( volume > 0 ) {
Expand Down

0 comments on commit 7b4b1ff

Please sign in to comment.