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 Sep 19, 2019
1 parent a3032ee commit e21f891
Show file tree
Hide file tree
Showing 54 changed files with 641 additions and 641 deletions.
2 changes: 1 addition & 1 deletion js/basics/EEBasicsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ define( require => {
*/
function EEBasicsScreen() {

var options = {
const options = {
name: basicsString,
backgroundColorProperty: new Property( EESharedConstants.NON_GAME_SCREENS_BACKGROUND_COLOR ),
homeScreenIcon: new EEBasicsIconNode()
Expand Down
10 changes: 5 additions & 5 deletions js/basics/view/EEBasicsIconNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ define( require => {
const Text = require( 'SCENERY/nodes/Text' );

// constants
var ICON_SIZE = Screen.MINIMUM_HOME_SCREEN_ICON_SIZE;
var BACKGROUND_COLOR = EESharedConstants.NON_GAME_SCREENS_BACKGROUND_COLOR;
var TEXT_FONT = new PhetFont( 84 );
const ICON_SIZE = Screen.MINIMUM_HOME_SCREEN_ICON_SIZE;
const BACKGROUND_COLOR = EESharedConstants.NON_GAME_SCREENS_BACKGROUND_COLOR;
const TEXT_FONT = new PhetFont( 84 );

/**
* @constructor
Expand All @@ -34,7 +34,7 @@ define( require => {
Rectangle.call( this, 0, 0, ICON_SIZE.width, ICON_SIZE.height, { fill: BACKGROUND_COLOR } );

// add the nodes
var coin1 = CoinNodeFactory.createImageNode( CoinTermTypeID.X, ICON_SIZE.height * 0.15, true );
const coin1 = CoinNodeFactory.createImageNode( CoinTermTypeID.X, ICON_SIZE.height * 0.15, true );
coin1.centerX = ICON_SIZE.width * 0.35;
coin1.centerY = ICON_SIZE.height / 2;
this.addChild( coin1 );
Expand All @@ -45,7 +45,7 @@ define( require => {
centerY: coin1.centerY
} ) );

var coin2 = CoinNodeFactory.createImageNode( CoinTermTypeID.Y, ICON_SIZE.height * 0.15, true );
const coin2 = CoinNodeFactory.createImageNode( CoinTermTypeID.Y, ICON_SIZE.height * 0.15, true );
coin2.centerX = ICON_SIZE.width * 0.75;
coin2.centerY = ICON_SIZE.height / 2;
this.addChild( coin2 );
Expand Down
2 changes: 1 addition & 1 deletion js/common/EEQueryParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define( require => {
// modules
const expressionExchange = require( 'EXPRESSION_EXCHANGE/expressionExchange' );

var EEQueryParameters = QueryStringMachine.getAll( {
const EEQueryParameters = QueryStringMachine.getAll( {

// control whether expression width is always adjusted or whether it sometimes remains constant
adjustExpressionWidth: { type: 'flag' },
Expand Down
2 changes: 1 addition & 1 deletion js/common/EESharedConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ define( require => {
const Dimension2 = require( 'DOT/Dimension2' );
const expressionExchange = require( 'EXPRESSION_EXCHANGE/expressionExchange' );

var EESharedConstants = {
const EESharedConstants = {

LAYOUT_BOUNDS: new Bounds2( 0, 0, 1024, 618 ), // at the time of this writing this is the same as the default

Expand Down
2 changes: 1 addition & 1 deletion js/common/enum/AllowedRepresentations.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define( require => {
// modules
const expressionExchange = require( 'EXPRESSION_EXCHANGE/expressionExchange' );

var AllowedRepresentations = {
const AllowedRepresentations = {
COINS_ONLY: 'COINS_ONLY',
VARIABLES_ONLY: 'VARIABLES_ONLY',
COINS_AND_VARIABLES: 'COINS_AND_VARIABLES'
Expand Down
2 changes: 1 addition & 1 deletion js/common/enum/CoinTermCreatorSetID.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define( require => {
// modules
const expressionExchange = require( 'EXPRESSION_EXCHANGE/expressionExchange' );

var CoinTermCreatorSetID = {
const CoinTermCreatorSetID = {
BASICS: 'BASICS',
EXPLORE: 'EXPLORE',
VARIABLES: 'VARIABLES'
Expand Down
2 changes: 1 addition & 1 deletion js/common/enum/CoinTermTypeID.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ define( require => {
// modules
const expressionExchange = require( 'EXPRESSION_EXCHANGE/expressionExchange' );

var CoinTermTypeID = {
const CoinTermTypeID = {
X: 'X',
Y: 'Y',
Z: 'Z',
Expand Down
2 changes: 1 addition & 1 deletion js/common/enum/ViewMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define( require => {
// modules
const expressionExchange = require( 'EXPRESSION_EXCHANGE/expressionExchange' );

var ViewMode = {
const ViewMode = {
COINS: 'COINS',
VARIABLES: 'VARIABLES'
};
Expand Down
36 changes: 18 additions & 18 deletions js/common/model/CoinTerm.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ define( require => {
const Vector2Property = require( 'DOT/Vector2Property' );

// constants
var COIN_TERM_FADE_TIME = 0.75; // in seconds
var CLOSE_ENOUGH_TO_HOME = 1E-6; // distance at which a coin term is considered to have returned to origin
var CARD_PRE_FADE_TIME = 0.25; // time before card starts to fade after user grabs it, in seconds
var CARD_FADE_TIME = 0.5; // time for a card to fade out
var MAX_ANIMATION_TIME = 1; // max time for an animation to complete
const COIN_TERM_FADE_TIME = 0.75; // in seconds
const CLOSE_ENOUGH_TO_HOME = 1E-6; // distance at which a coin term is considered to have returned to origin
const CARD_PRE_FADE_TIME = 0.25; // time before card starts to fade after user grabs it, in seconds
const CARD_FADE_TIME = 0.5; // time for a card to fade out
const MAX_ANIMATION_TIME = 1; // max time for an animation to complete

// class var for creating unique IDs
var creationCount = 0;
let creationCount = 0;

/**
* @param {Property.<number>} valueProperty - value of the coin term wrapped in a property
Expand All @@ -44,7 +44,7 @@ define( require => {
*/
function CoinTerm( valueProperty, coinRadius, termText, termValueTextProperty, typeID, options ) {

var self = this;
const self = this;
this.id = 'CT-' + ( ++creationCount ); // @public (read-only) - unique ID useful for debugging

options = _.extend( {
Expand Down Expand Up @@ -215,14 +215,14 @@ define( require => {
step: function( dt ) {

// if there is an animation in progress, step it
var animation = this.inProgressAnimationProperty.get();
const animation = this.inProgressAnimationProperty.get();
if ( animation ) {
animation.timeSoFar += dt;
if ( animation.timeSoFar < animation.totalDuration ) {

// not there yet - take a step towards the destination
var proportionCompleted = animation.timeSoFar / animation.totalDuration;
var easingProportion = Easing.CUBIC_IN_OUT.value( proportionCompleted );
const proportionCompleted = animation.timeSoFar / animation.totalDuration;
const easingProportion = Easing.CUBIC_IN_OUT.value( proportionCompleted );
this.positionProperty.set(
animation.startPosition.plus(
animation.travelVector.withMagnitude( animation.travelVector.magnitude * easingProportion )
Expand Down Expand Up @@ -279,7 +279,7 @@ define( require => {
*/
travelToDestination: function( destination ) {
this.destinationProperty.set( destination );
var currentPosition = this.positionProperty.get();
const currentPosition = this.positionProperty.get();
if ( currentPosition.equals( destination ) ) {

// The coin terms is already at the destination, no animation is required, but emit a notification in case the
Expand All @@ -289,7 +289,7 @@ define( require => {
else {

// calculate the time needed to get to the destination
var animationDuration = Math.min(
const animationDuration = Math.min(
this.positionProperty.get().distance( destination ) / EESharedConstants.COIN_TERM_MOVEMENT_SPEED,
MAX_ANIMATION_TIME
);
Expand Down Expand Up @@ -355,12 +355,12 @@ define( require => {
*/
absorb: function( coinTermToAbsorb, doPartialCancellation ) {
assert && assert( this.typeID === coinTermToAbsorb.typeID, 'can\'t combine coin terms of different types' );
var self = this;
const self = this;
this.totalCountProperty.value += coinTermToAbsorb.totalCountProperty.value;

if ( doPartialCancellation ) {
coinTermToAbsorb.composition.forEach( function( minDecomposableValue ) {
var index = self.composition.indexOf( -1 * minDecomposableValue );
const index = self.composition.indexOf( -1 * minDecomposableValue );
if ( index > -1 ) {
// cancel this value from the composition of the receiving coin term
self.composition.splice( index, 1 );
Expand All @@ -384,11 +384,11 @@ define( require => {
* @public
*/
extractConstituentCoinTerms: function() {
var extractedCoinTerms = [];
const extractedCoinTerms = [];

// create a coin term to reflect each one from which this one is composed
for ( var i = 1; i < this.composition.length; i++ ) {
var extractedCoinTerm = new CoinTerm(
for ( let i = 1; i < this.composition.length; i++ ) {
const extractedCoinTerm = new CoinTerm(
this.valueProperty,
this.coinRadius,
this.termText,
Expand Down Expand Up @@ -443,7 +443,7 @@ define( require => {
* @public
*/
getViewBounds: function() {
var position = this.positionProperty.get();
const position = this.positionProperty.get();
return this.localViewBoundsProperty.get().shifted( position.x, position.y );
},

Expand Down
12 changes: 6 additions & 6 deletions js/common/model/CoinTermFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ define( require => {
const Property = require( 'AXON/Property' );

// constants
var CONSTANT_ONE_VALUE_PROPERTY = new Property( 1 );
var CONSTANT_ONE_TEXT_VALUE_PROPERTY = new Property( '1' );
const CONSTANT_ONE_VALUE_PROPERTY = new Property( 1 );
const CONSTANT_ONE_TEXT_VALUE_PROPERTY = new Property( '1' );

/**
* @param {number} xValueProperty
Expand Down Expand Up @@ -125,10 +125,10 @@ define( require => {
*/
createCoinTerm: function( typeID, options ) {

var valueProperty;
var coinRadius;
var termText;
var termValueTextProperty;
let valueProperty;
let coinRadius;
let termText;
let termValueTextProperty;

// set up the various values and properties based on the specified type ID
switch( typeID ) {
Expand Down
Loading

0 comments on commit e21f891

Please sign in to comment.