Skip to content

Commit

Permalink
fix PhET-iO instrumentation of HydrogenAtom Emitters
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jan 18, 2025
1 parent f5826dd commit ba427d6
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions js/common/model/HydrogenAtom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import IOType from '../../../../tandem/js/types/IOType.js';
import ReferenceIO, { ReferenceIOState } from '../../../../tandem/js/types/ReferenceIO.js';
import modelsOfTheHydrogenAtom from '../../modelsOfTheHydrogenAtom.js';
import Photon from './Photon.js';
import NumberIO from '../../../../tandem/js/types/NumberIO.js';
import NullableIO from '../../../../tandem/js/types/NullableIO.js';

export type HydrogenAtomStateObject = ReferenceIOState;

Expand Down Expand Up @@ -76,24 +78,26 @@ export default abstract class HydrogenAtom extends PhetioObject {
this.tandemNamePrefix = options.tandemNamePrefix;

this.photonAbsorbedEmitter = new Emitter<[ Photon ]>( {
parameters: [ { name: 'photon', valueType: Photon, phetioType: Photon.PhotonIO } ],
parameters: [
{ name: 'photon', valueType: Photon, phetioType: Photon.PhotonIO }
],
tandem: options.tandem.createTandem( 'photonAbsorbedEmitter' ),
phetioDocumentation: 'Register with this Emitter to be notified when a photon is absorbed.' +
' Included for all hydrogen atom models, regardless of whether they absorb photons, so that' +
' all models have the same API.'
' Included for all hydrogen atom models, regardless of whether they absorb photons,' +
' so that all models have the same API.'
} );

this.photonEmittedEmitter = new Emitter<[ number, Vector2, number, Color ]>( {
parameters: [
{ name: 'wavelength', valueType: 'number' },
{ name: 'position', valueType: Vector2 },
{ name: 'direction', valueType: 'number' },
{ name: 'debugHalo', valueType: Color }
{ name: 'wavelength', valueType: 'number', phetioType: NumberIO },
{ name: 'position', valueType: Vector2, phetioType: Vector2.Vector2IO },
{ name: 'direction', valueType: 'number', phetioType: NumberIO },
{ name: 'debugHalo', valueType: Color || null, phetioType: NullableIO( Color.ColorIO ) }
],
tandem: options.tandem.createTandem( 'photonEmittedEmitter' ),
phetioDocumentation: 'Register with this Emitter to be notified when a photon is emitted.' +
' Included for all hydrogen atom models, regardless of whether they emit photons, so that' +
' all models have the same API.'
' Included for all hydrogen atom models, regardless of whether they emit photons' +
' so that all models have the same API.'
} );
}

Expand Down

1 comment on commit ba427d6

@pixelzoom
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#47

Please sign in to comment.