Skip to content

Commit

Permalink
replaced init constructor with explicit set operations, see #75
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Sep 10, 2019
1 parent bc061db commit e5d64ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
13 changes: 6 additions & 7 deletions js/sound-generators/CheckboxSoundGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ define( require => {
initialOutputLevel: 0.7
}, options );

super(
new Map( [
[ true, checkboxChecked ],
[ false, checkboxUnchecked ]
] ),
options
);
// create the map of boolean values to sounds
const valuesToSoundInfoMap = new Map(); // can't use initialization constructor since it's not supported in IE
valuesToSoundInfoMap.set( true, checkboxChecked );
valuesToSoundInfoMap.set( false, checkboxUnchecked );

super( valuesToSoundInfoMap, options );

const checkboxPropertyListener = value => {
if ( !resetInProgressProperty.value ) {
Expand Down
11 changes: 7 additions & 4 deletions js/sound-generators/ScreenSelectionSoundGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ define( require => {
*/
constructor( currentScreenProperty, iconIndexProperty, options ) {

super(
new Map( [ [ 0, iconSelectedSound ], [ 1, homeSelectedSound ], [ 2, screenSelectedSound ] ] ),
options
);
// create the map of screen index values to sounds
const valuesToSoundInfoMap = new Map(); // can't use initialization constructor since it's not supported in IE
valuesToSoundInfoMap.set( 0, iconSelectedSound );
valuesToSoundInfoMap.set( 1, homeSelectedSound );
valuesToSoundInfoMap.set( 2, screenSelectedSound );

super( valuesToSoundInfoMap, options );

// play the sound when the user selects a different icon on the home screen
iconIndexProperty.lazyLink( () => {
Expand Down

0 comments on commit e5d64ef

Please sign in to comment.