Skip to content

Commit

Permalink
Use arrow functions in IOType state functions, see phetsims/tandem#211
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid authored and jessegreenberg committed Apr 21, 2021
1 parent f3efa6a commit e1074fb
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions js/photon-absorption/model/PhotonIO.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,12 @@ import moleculesAndLight from '../../moleculesAndLight.js';

const PhotonIO = new IOType( 'PhotonIO', {
isValidValue: v => v instanceof phet.moleculesAndLight.Photon,

/**
* @public
* @override
*
* @param {Photon} photon
* @returns {Object}
*/
toStateObject( photon ) {
return {
vx: NumberIO.toStateObject( photon.vx ),
vy: NumberIO.toStateObject( photon.vy ),
wavelength: NumberIO.toStateObject( photon.wavelength ),
phetioID: photon.tandem.phetioID
};
},
toStateObject: photon => ( {
vx: NumberIO.toStateObject( photon.vx ),
vy: NumberIO.toStateObject( photon.vy ),
wavelength: NumberIO.toStateObject( photon.wavelength ),
phetioID: photon.tandem.phetioID
} ),

/**
* This is sometimes data-type and sometimes reference-type serialization, if the photon has already be created,
Expand Down

0 comments on commit e1074fb

Please sign in to comment.