phetsims / make-a-ten

"Making Tens" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
1 stars 3 forks source link

Misuse of DerivedProperty.valueEquals #278

Closed samreid closed 7 years ago

samreid commented 7 years ago

MakeATenGameScreenView.js has:

var showingLeftProperty = DerivedProperty.valueEquals( model.gameStateProperty,
  new Property( GameState.CHOOSING_LEVEL ) );

This creates a new constant Property just for the sake of using valueEquals. It seems it would be better to use:

var showingLeftProperty = new DerivedProperty( model.gameStateProperty, function( gameState ) {
  return gameState === GameState.CHOOSING_LEVEL;
} );
jonathanolson commented 7 years ago

Implemented the change (with array-ification for the DerivedProperty first parameter).

Thanks!