Skip to content

Commit

Permalink
remove some more usages of Tandem.OPTIONAL, phetsims/tandem#289
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jun 26, 2023
1 parent c3cc97e commit 15d0e8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
5 changes: 1 addition & 4 deletions js/Announcer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Emitter from '../../axon/js/Emitter.js';
import TEmitter from '../../axon/js/TEmitter.js';
import optionize, { EmptySelfOptions } from '../../phet-core/js/optionize.js';
import PhetioObject, { PhetioObjectOptions } from '../../tandem/js/PhetioObject.js';
import Tandem from '../../tandem/js/Tandem.js';
import IOType from '../../tandem/js/types/IOType.js';
import NullableIO from '../../tandem/js/types/NullableIO.js';
import NumberIO from '../../tandem/js/types/NumberIO.js';
Expand Down Expand Up @@ -49,8 +48,6 @@ abstract class Announcer extends PhetioObject {
public constructor( providedOptions?: AnnouncerOptions ) {
const options = optionize<AnnouncerOptions, SelfOptions, PhetioObjectOptions>()( {
respectResponseCollectorProperties: true,

tandem: Tandem.OPTIONAL,
phetioType: Announcer.AnnouncerIO,
phetioState: false
}, providedOptions );
Expand All @@ -66,7 +63,7 @@ abstract class Announcer extends PhetioObject {
name: 'text',
phetioType: NullableIO( OrIO( [ StringIO, NumberIO ] ) )
} ],
tandem: options.tandem.createTandem( 'announcementCompleteEmitter' ),
tandem: options.tandem?.createTandem( 'announcementCompleteEmitter' ),
phetioReadOnly: true,
phetioDocumentation: 'The announcement that has just completed. The Utterance text could potentially differ from ' +
'the exact text that was announced, so both are emitted. Use `text` for an exact match of what was announced.'
Expand Down
13 changes: 5 additions & 8 deletions js/SpeechSynthesisAnnouncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import stepTimer from '../../axon/js/stepTimer.js';
import platform from '../../phet-core/js/platform.js';
import Multilink from '../../axon/js/Multilink.js';
import TEmitter from '../../axon/js/TEmitter.js';
import Tandem from '../../tandem/js/Tandem.js';
import IOType from '../../tandem/js/types/IOType.js';
import NullableIO from '../../tandem/js/types/NullableIO.js';
import validate from '../../axon/js/validate.js';
Expand Down Expand Up @@ -251,31 +250,29 @@ class SpeechSynthesisAnnouncer extends Announcer {
// that is more specific to the Voicing feature.
respectResponseCollectorProperties: false,

debug: false,

tandem: Tandem.OPTIONAL
debug: false
}, providedOptions );

super( options );

this.debug = options.debug;

this.voiceProperty = new Property<null | SpeechSynthesisVoice>( null, {
tandem: options.tandem.createTandem( 'voiceProperty' ),
tandem: options.tandem?.createTandem( 'voiceProperty' ),
phetioValueType: NullableIO( SpeechSynthesisVoiceIO ),
phetioState: false,
phetioReadOnly: true,
phetioDocumentation: 'the voice that is currently voicing responses'
} );
this.voiceRateProperty = new NumberProperty( 1.0, {
range: new Range( 0.75, 2 ),
tandem: options.tandem.createTandem( 'voiceRateProperty' ),
tandem: options.tandem?.createTandem( 'voiceRateProperty' ),
phetioState: false,
phetioDocumentation: 'changes the rate of the voicing-feature voice'
} );
this.voicePitchProperty = new NumberProperty( 1.0, {
range: new Range( 0.5, 2 ),
tandem: options.tandem.createTandem( 'voicePitchProperty' ),
tandem: options.tandem?.createTandem( 'voicePitchProperty' ),
phetioState: false,
phetioDocumentation: 'changes the pitch of the voicing-feature voice'
} );
Expand Down Expand Up @@ -316,7 +313,7 @@ class SpeechSynthesisAnnouncer extends Announcer {
this.enabledProperty = this.enabledComponentImplementation.enabledProperty;

this.mainWindowVoicingEnabledProperty = new BooleanProperty( true, {
tandem: options.tandem.createTandem( 'mainWindowVoicingEnabledProperty' ),
tandem: options.tandem?.createTandem( 'mainWindowVoicingEnabledProperty' ),
phetioState: false,
phetioDocumentation: 'toggles the voicing feature on and off for the simulation screen (not the voicing preferences and toolbar controls)'
} );
Expand Down

0 comments on commit 15d0e8d

Please sign in to comment.