Skip to content

Commit

Permalink
ES6 module migration, see phetsims/chipper#875
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid authored and jessegreenberg committed Apr 21, 2021
1 parent 6712eec commit b93b7f9
Show file tree
Hide file tree
Showing 12 changed files with 2,505 additions and 2,549 deletions.
47 changes: 22 additions & 25 deletions js/moleculesandlight/MoleculesAndLightScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,29 @@
* @author Jesse Greenberg (PhET Interactive Simulations)
* @author Sam Reid (PhET Interactive Simulations)
*/
define( require => {
'use strict';

// modules
const inherit = require( 'PHET_CORE/inherit' );
const moleculesAndLight = require( 'MOLECULES_AND_LIGHT/moleculesAndLight' );
const MoleculesAndLightScreenView = require( 'MOLECULES_AND_LIGHT/moleculesandlight/view/MoleculesAndLightScreenView' );
const MoleculesAndLightModel = require( 'MOLECULES_AND_LIGHT/moleculesandlight/model/MoleculesAndLightModel' );
const Property = require( 'AXON/Property' );
const Screen = require( 'JOIST/Screen' );
import Property from '../../../axon/js/Property.js';
import Screen from '../../../joist/js/Screen.js';
import inherit from '../../../phet-core/js/inherit.js';
import moleculesAndLight from '../moleculesAndLight.js';
import MoleculesAndLightModel from './model/MoleculesAndLightModel.js';
import MoleculesAndLightScreenView from './view/MoleculesAndLightScreenView.js';

/**
* @param {Tandem} tandem
* @constructor
*/
function MoleculesAndLightScreen( tandem ) {
Screen.call( this,
function() { return new MoleculesAndLightModel( tandem.createTandem( 'model' ) ); },
function( model ) { return new MoleculesAndLightScreenView( model, tandem.createTandem( 'view' ) ); }, {
backgroundColorProperty: new Property( '#C5D6E8' ),
tandem: tandem
}
);
}
/**
* @param {Tandem} tandem
* @constructor
*/
function MoleculesAndLightScreen( tandem ) {
Screen.call( this,
function() { return new MoleculesAndLightModel( tandem.createTandem( 'model' ) ); },
function( model ) { return new MoleculesAndLightScreenView( model, tandem.createTandem( 'view' ) ); }, {
backgroundColorProperty: new Property( '#C5D6E8' ),
tandem: tandem
}
);
}

moleculesAndLight.register( 'MoleculesAndLightScreen', MoleculesAndLightScreen );
moleculesAndLight.register( 'MoleculesAndLightScreen', MoleculesAndLightScreen );

return inherit( Screen, MoleculesAndLightScreen );
} );
inherit( Screen, MoleculesAndLightScreen );
export default MoleculesAndLightScreen;
39 changes: 18 additions & 21 deletions js/moleculesandlight/model/MoleculesAndLightModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,26 @@
*
* @author Jesse Greenberg
*/
define( require => {
'use strict';

// modules
const moleculesAndLight = require( 'MOLECULES_AND_LIGHT/moleculesAndLight' );
const PhotonAbsorptionModel = require( 'MOLECULES_AND_LIGHT/photon-absorption/model/PhotonAbsorptionModel' );
const PhotonTarget = require( 'MOLECULES_AND_LIGHT/photon-absorption/model/PhotonTarget' );
import moleculesAndLight from '../../moleculesAndLight.js';
import PhotonAbsorptionModel from '../../photon-absorption/model/PhotonAbsorptionModel.js';
import PhotonTarget from '../../photon-absorption/model/PhotonTarget.js';

/**
* @public
*/
class MoleculesAndLightModel extends PhotonAbsorptionModel {
constructor( tandem ) {
super( PhotonTarget.SINGLE_CO_MOLECULE, tandem );
/**
* @public
*/
class MoleculesAndLightModel extends PhotonAbsorptionModel {
constructor( tandem ) {
super( PhotonTarget.SINGLE_CO_MOLECULE, tandem );

// Clear all photons to avoid cases where photons of the previous wavelength
// could be absorbed after new wavelength was selected. Some users interpreted
// absorption of the previous wavelength as absorption of the selected wavelength
this.photonWavelengthProperty.link( () => {
this.resetPhotons();
} );
}
// Clear all photons to avoid cases where photons of the previous wavelength
// could be absorbed after new wavelength was selected. Some users interpreted
// absorption of the previous wavelength as absorption of the selected wavelength
this.photonWavelengthProperty.link( () => {
this.resetPhotons();
} );
}
}

return moleculesAndLight.register( 'MoleculesAndLightModel', MoleculesAndLightModel );
} );
moleculesAndLight.register( 'MoleculesAndLightModel', MoleculesAndLightModel );
export default MoleculesAndLightModel;
877 changes: 437 additions & 440 deletions js/moleculesandlight/view/ActiveMoleculeAlertManager.js

Large diffs are not rendered by default.

40 changes: 18 additions & 22 deletions js/moleculesandlight/view/LightSpectrumDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,26 @@
* @author Jesse Greenberg
*/

define( require => {
'use strict';
import inherit from '../../../../phet-core/js/inherit.js';
import Dialog from '../../../../sun/js/Dialog.js';
import moleculesAndLight from '../../moleculesAndLight.js';

// modules
const Dialog = require( 'SUN/Dialog' );
const inherit = require( 'PHET_CORE/inherit' );
const moleculesAndLight = require( 'MOLECULES_AND_LIGHT/moleculesAndLight' );

/**
* @constructor
* @param {Node} content - content for the dialog
* @param {Tandem} tandem
*/
function LightSpectrumDialog( content, tandem ) {
/**
* @constructor
* @param {Node} content - content for the dialog
* @param {Tandem} tandem
*/
function LightSpectrumDialog( content, tandem ) {

Dialog.call( this, content, {
Dialog.call( this, content, {

// phet-io
tandem: tandem,
phetioDynamicElement: true
} );
}
// phet-io
tandem: tandem,
phetioDynamicElement: true
} );
}

moleculesAndLight.register( 'LightSpectrumDialog', LightSpectrumDialog );
moleculesAndLight.register( 'LightSpectrumDialog', LightSpectrumDialog );

return inherit( Dialog, LightSpectrumDialog );
} );
inherit( Dialog, LightSpectrumDialog );
export default LightSpectrumDialog;
Loading

0 comments on commit b93b7f9

Please sign in to comment.