12
12
import Vector2 from '../../../../dot/js/Vector2.js' ;
13
13
import Vector2Property from '../../../../dot/js/Vector2Property.js' ;
14
14
import inherit from '../../../../phet-core/js/inherit.js' ;
15
+ import merge from '../../../../phet-core/js/merge.js' ;
15
16
import CouldNotYetDeserializeError from '../../../../tandem/js/CouldNotYetDeserializeError.js' ;
16
17
import PhetioObject from '../../../../tandem/js/PhetioObject.js' ;
18
+ import Tandem from '../../../../tandem/js/Tandem.js' ;
17
19
import IOType from '../../../../tandem/js/types/IOType.js' ;
18
20
import NumberIO from '../../../../tandem/js/types/NumberIO.js' ;
19
21
import moleculesAndLight from '../../moleculesAndLight.js' ;
@@ -22,13 +24,19 @@ import moleculesAndLight from '../../moleculesAndLight.js';
22
24
* Constructor for a photon.
23
25
*
24
26
* @param {Number } wavelength
25
- * @param {Tandem } tandem
27
+ * @param {Object } [options]
26
28
* @constructor
27
29
*/
28
- function Photon ( wavelength , tandem ) {
30
+ function Photon ( wavelength , options ) {
31
+
32
+ options = merge ( {
33
+ tandem : Tandem . REQUIRED ,
34
+ phetioType : Photon . PhotonIO ,
35
+ phetioDynamicElement : true
36
+ } , options ) ;
29
37
30
38
this . positionProperty = new Vector2Property ( new Vector2 ( 0 , 0 ) , {
31
- tandem : tandem . createTandem ( 'positionProperty' )
39
+ tandem : options . tandem . createTandem ( 'positionProperty' )
32
40
} ) ;
33
41
34
42
// @private
@@ -37,11 +45,7 @@ function Photon( wavelength, tandem ) {
37
45
this . vy = 0 ; // y component of the photon velocity
38
46
39
47
// Photons in the play area are instrumented, those in the control panel (for icons) are not.
40
- PhetioObject . call ( this , {
41
- tandem : tandem ,
42
- phetioType : Photon . PhotonIO ,
43
- phetioDynamicElement : true
44
- } ) ;
48
+ PhetioObject . call ( this , options ) ;
45
49
}
46
50
47
51
moleculesAndLight . register ( 'Photon' , Photon ) ;
0 commit comments