Skip to content

Commit

Permalink
var -> const using eslint auto fix, phetsims/tasks#1012
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Oct 14, 2019
1 parent a243507 commit 5bf2547
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 42 deletions.
8 changes: 4 additions & 4 deletions js/gravity-force-lab-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ define( require => {
const Tandem = require( 'TANDEM/Tandem' );

// constants
var tandem = Tandem.rootTandem;
const tandem = Tandem.rootTandem;

// strings
const gravityForceLabTitleString = require( 'string!GRAVITY_FORCE_LAB/gravity-force-lab.title' );
var keyboardHelpContent = new GravityForceLabKeyboardHelpContent();
const keyboardHelpContent = new GravityForceLabKeyboardHelpContent();

var simOptions = {
const simOptions = {
credits: {
softwareDevelopment: 'John Blanco, Aadish Gupta, Sam Reid',
team: 'Wendy Adams, Trish Loeblein, Ariel Paul, Noah Podolefsky, Amy Rouinfar, Carl Wieman',
Expand All @@ -38,7 +38,7 @@ define( require => {

SimLauncher.launch( function() {

var gravityForceLabScreenTandem = tandem.createTandem( 'gravityForceLabScreen' );
const gravityForceLabScreenTandem = tandem.createTandem( 'gravityForceLabScreen' );

// create and start the sim
new Sim( gravityForceLabTitleString, [
Expand Down
18 changes: 9 additions & 9 deletions js/gravity-force-lab/model/GravityForceLabModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ define( require => {
} );

// pass initial masses and positions into the model
var massValue1 = 100; // mass in kg
var massValue2 = 400; // mass in kg
const massValue1 = 100; // mass in kg
const massValue2 = 400; // mass in kg

var position1 = -2; // in meters
var position2 = 2; // in meters
const position1 = -2; // in meters
const position2 = 2; // in meters

var baseColor1 = GravityForceLabConstants.MASS_BLUE_COLOR;
var baseColor2 = GravityForceLabConstants.MASS_RED_COLOR;
const baseColor1 = GravityForceLabConstants.MASS_BLUE_COLOR;
const baseColor2 = GravityForceLabConstants.MASS_RED_COLOR;

var density = 150; // in kg/m^3
const density = 150; // in kg/m^3

var mass1 = new Mass( massValue1, position1, GravityForceLabConstants.MASS_RANGE, density,
const mass1 = new Mass( massValue1, position1, GravityForceLabConstants.MASS_RANGE, density,
this.constantRadiusProperty, baseColor1, tandem.createTandem( 'mass1' ) );
var mass2 = new Mass( massValue2, position2, GravityForceLabConstants.MASS_RANGE, density,
const mass2 = new Mass( massValue2, position2, GravityForceLabConstants.MASS_RANGE, density,
this.constantRadiusProperty, baseColor2, tandem.createTandem( 'mass2' ) );

// leverage ISLCModel, in "mass" mode
Expand Down
6 changes: 3 additions & 3 deletions js/gravity-force-lab/model/Mass.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ define( require => {

// constants
// scale to brighten the base color to achieve rgba(150, 150, 255) but still be red or blue
var baseColorModifier = 0.59;
const baseColorModifier = 0.59;

/**
* @param {number} initialMass
Expand Down Expand Up @@ -59,8 +59,8 @@ define( require => {
* @param {number} mass
*/
calculateRadius: function( mass ) {
var sphereVolume = mass / this.density;
var sphereRadius = Math.pow( ( 3 * sphereVolume ) / ( 4 * Math.PI ), 1 / 3 );
const sphereVolume = mass / this.density;
const sphereRadius = Math.pow( ( 3 * sphereVolume ) / ( 4 * Math.PI ), 1 / 3 );
return sphereRadius;
}
} );
Expand Down
4 changes: 2 additions & 2 deletions js/gravity-force-lab/view/GravityForceLabScreenSummaryNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ define( require => {
labelContent: options.simStateLabel
} );

var mainSummaryDescriptionNode = new Node( { tagName: 'p', innerContent: options.mainDescriptionContent } );
var secondSummaryDescriptionNode = new Node( {
const mainSummaryDescriptionNode = new Node( { tagName: 'p', innerContent: options.mainDescriptionContent } );
const secondSummaryDescriptionNode = new Node( {
tagName: 'p',
innerContent: options.secondaryDescriptionContent
} );
Expand Down
48 changes: 24 additions & 24 deletions js/gravity-force-lab/view/GravityForceLabScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,25 @@ define( require => {
const unitsMetersString = require( 'string!INVERSE_SQUARE_LAW_COMMON/units.meters' );

// a11y Strings
var massControlsLabelString = GravityForceLabA11yStrings.massControlsLabel.value;
var massControlsHelpTextString = GravityForceLabA11yStrings.massControlsHelpText.value;
var massControlsHelpTextDensityString = GravityForceLabA11yStrings.massControlsHelpTextDensity.value;
var constantSizeCheckboxHelpTextString = GravityForceLabA11yStrings.constantSizeCheckboxHelpText.value;
var forceValuesCheckboxHelpTextString = GravityForceLabA11yStrings.forceValuesCheckboxHelpText.value;
var scientificNotationCheckboxHelpTextString = ISLCA11yStrings.scientificNotationCheckboxHelpText.value;
const massControlsLabelString = GravityForceLabA11yStrings.massControlsLabel.value;
const massControlsHelpTextString = GravityForceLabA11yStrings.massControlsHelpText.value;
const massControlsHelpTextDensityString = GravityForceLabA11yStrings.massControlsHelpTextDensity.value;
const constantSizeCheckboxHelpTextString = GravityForceLabA11yStrings.constantSizeCheckboxHelpText.value;
const forceValuesCheckboxHelpTextString = GravityForceLabA11yStrings.forceValuesCheckboxHelpText.value;
const scientificNotationCheckboxHelpTextString = ISLCA11yStrings.scientificNotationCheckboxHelpText.value;

// constants
var CONTROL_SCALE = 0.72;
var SHOW_GRID = ISLCQueryParameters.showGrid;
var OBJECT_ONE = ISLCObjectEnum.OBJECT_ONE;
var OBJECT_TWO = ISLCObjectEnum.OBJECT_TWO;
var CHECKBOX_TEXT_SIZE = 15;
const CONTROL_SCALE = 0.72;
const SHOW_GRID = ISLCQueryParameters.showGrid;
const OBJECT_ONE = ISLCObjectEnum.OBJECT_ONE;
const OBJECT_TWO = ISLCObjectEnum.OBJECT_TWO;
const CHECKBOX_TEXT_SIZE = 15;

function GravityForceLabScreenView( model, tandem ) {

// force text isn't retrieved directly in the screenview, we simply initialize and access it in various Nodes
const massDescriber = new MassDescriber( model );
var positionDescriber = new GravityForceLabPositionDescriber( model, mass1AbbreviatedString, mass2AbbreviatedString );
const positionDescriber = new GravityForceLabPositionDescriber( model, mass1AbbreviatedString, mass2AbbreviatedString );
const forceDescriber = new GravityForceLabForceDescriber( model, mass1AbbreviatedString, mass2AbbreviatedString, positionDescriber );

ScreenView.call( this, {
Expand All @@ -77,19 +77,19 @@ define( require => {
tandem: tandem
} );

var alertManager = new GravityForceLabAlertManager( model, massDescriber, forceDescriber );
const alertManager = new GravityForceLabAlertManager( model, massDescriber, forceDescriber );

// Create the model-view transform. The primary units used in the model are meters, so significant zoom is used.
// The multipliers for the 2nd parameter can be used to adjust where the point (0, 0) in the model, which is
// between the two masses.
var modelViewTransform = ModelViewTransform2.createSinglePointScaleInvertedYMapping(
const modelViewTransform = ModelViewTransform2.createSinglePointScaleInvertedYMapping(
Vector2.ZERO,
new Vector2( this.layoutBounds.width / 2, this.layoutBounds.height / 2 ),
50
);

// add the mass nodes to the screen
var mass1Node = new MassNode(
const mass1Node = new MassNode(
model,
model.object1,
this.layoutBounds,
Expand All @@ -107,7 +107,7 @@ define( require => {
}
);

var mass2Node = new MassNode(
const mass2Node = new MassNode(
model,
model.object2,
this.layoutBounds,
Expand Down Expand Up @@ -136,7 +136,7 @@ define( require => {
this.addChild( mass2Node.arrowNode );

// @private - added to object for animation stepping
var gravityForceLabRuler = new ISLCRulerNode(
const gravityForceLabRuler = new ISLCRulerNode(
model,
this.layoutBounds.height,
modelViewTransform,
Expand All @@ -149,7 +149,7 @@ define( require => {
);
this.addChild( gravityForceLabRuler );

var massControlsNode = new Node( {
const massControlsNode = new Node( {
labelTagName: 'h3',
labelContent: massControlsLabelString,
tagName: 'div',
Expand All @@ -169,7 +169,7 @@ define( require => {
const propertiesToMonitorForDescriptionChanges = [ model.forceProperty, model.constantRadiusProperty ];

// mass controls
var massControl1 = new MassControl(
const massControl1 = new MassControl(
mass1String,
model.object1.valueProperty,
GravityForceLabConstants.MASS_RANGE,
Expand All @@ -184,7 +184,7 @@ define( require => {
massControl1.scale( CONTROL_SCALE );
massControlsNode.addChild( massControl1 );

var massControl2 = new MassControl(
const massControl2 = new MassControl(
mass2String,
model.object2.valueProperty,
GravityForceLabConstants.MASS_RANGE,
Expand All @@ -203,7 +203,7 @@ define( require => {
} );

const controlPanelTandem = tandem.createTandem( 'parameterControlPanel' );
var checkboxItems = [
const checkboxItems = [
{
label: constantSizeString, property: model.constantRadiusProperty,
tandem: controlPanelTandem.createTandem( 'constantRadiusCheckbox' ),
Expand Down Expand Up @@ -233,7 +233,7 @@ define( require => {
}
];

var parameterControlPanel = new ISLCCheckboxPanel( checkboxItems, {
const parameterControlPanel = new ISLCCheckboxPanel( checkboxItems, {
tandem: controlPanelTandem,
fill: '#FDF498',
xMargin: 10,
Expand All @@ -243,7 +243,7 @@ define( require => {
} );
this.addChild( parameterControlPanel );

var resetAllButton = new ResetAllButton( {
const resetAllButton = new ResetAllButton( {
listener: function() {
model.reset();
gravityForceLabRuler.reset();
Expand Down Expand Up @@ -285,7 +285,7 @@ define( require => {
resetAllButton.top = parameterControlPanel.bottom + 13.5;

if ( SHOW_GRID ) {
var gridNode = new ISLCGridNode(
const gridNode = new ISLCGridNode(
GravityForceLabConstants.LOCATION_SNAP_VALUE,
this.layoutBounds,
modelViewTransform,
Expand Down

0 comments on commit 5bf2547

Please sign in to comment.