Closed zepumph closed 2 years ago
Im sure this is great, but can you please comment on why it is beneficial to be able to instantiate a ResponsePatterns?
Only minor reasons as I worked on https://github.com/phetsims/utterance-queue/issues/31.
validatePatternKeys
. A POJO will make this more type safe (especially with typescript coming soon).Another minor thing. @jessegreenberg do you think we should rename to something that is singular?
@jessegreenberg please review, and comment on the above thought about a rename.
The change looks good. A rename would also make sense. Was originally plural because the VoicingResponsePatterns object was expected to contain multiple objects like DEFAULT_RESPONSE_PATTERNS that might be helpful. Now that it is a class the reusable the reusable ones can be added statically like
ResponsePattern.MODIFIED_RESPONSE_PATTERNS = new ResponsePattern( {
//...
} )
It will contain a collection of response patterns, so maybe the name should be ResponsePatternCollection? With usages like
this.voicingResponsePatterns = ResponsePatternCollection.MODIFIED_RESPONSE_PATTERNS
this.voicingResponsePatterns = new ResponsePatternCollection( {
nameContextHint: '{{NAME}}! {{CONTEXT}}? {{HINT}}...',
Hows that?
Looks very good, thanks for this improvement! I like how this looks when overriding the default patterns
voicingResponsePatternCollection: new ResponsePatternCollection( {
nameObjectHint: '{{OBJECT}}, {{NAME}}, {{HINT}}',
nameObject: '{{OBJECT}}, {{NAME}}'
} )
(renamed from VoicingResponesPatterns in https://github.com/phetsims/utterance-queue/issues/31).