Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an enumeration for Utterance priorities #78

Closed
jessegreenberg opened this issue Apr 13, 2022 · 3 comments
Closed

Create an enumeration for Utterance priorities #78

jessegreenberg opened this issue Apr 13, 2022 · 3 comments
Assignees

Comments

@jessegreenberg
Copy link
Contributor

Currently Priorities can take any number value, it would be better if there were some limit on the values you could provide. It seems like allowing any number could turn into mayhem.

We think an enumeration for these values would be nice. We also considered typing Priority, but we want to start with enumeration.

@jessegreenberg jessegreenberg self-assigned this Apr 13, 2022
@zepumph
Copy link
Member

zepumph commented Apr 13, 2022

see phetsims/joist#752 (comment)

@zepumph
Copy link
Member

zepumph commented Aug 1, 2022

Something like:

class Priority extends EnumerationValue {
  // Priority levels that can be used by Utterances providing the `announcerOptions.priority` option.
  public static TOP_PRIORITY = new Priority( 10 );
  public static HIGH_PRIORITY = new Priority( 5 );
  public static MEDIUM_PRIORITY = new Priority( 2 );
  public static DEFAULT_PRIORITY = new Priority( DEFAULT_PRIORITY );
  public static LOW_PRIORITY = new Priority( 0 );

  public constructor( public readonly priorityNumber: number ) {super();}

  public static enumeration = new Enumeration( Priority );
}

@zepumph
Copy link
Member

zepumph commented Mar 3, 2023

I kinda like just having a number. It makes things a bit more flexible and so far we haven't run into trouble. Closing, but please reopen if you disagree.

@zepumph zepumph closed this as completed Mar 3, 2023
@zepumph zepumph removed their assignment Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants