-
Notifications
You must be signed in to change notification settings - Fork 6
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
Enumeration conventions #53
Comments
Some "rules of thumb" for deciding where to put an Enumeration:
// LayoutBox.js
class LayoutBox extends ... {
constructor(..., options ) {
options = _.extend( {
orientation: LayoutBox.Orientation.HORIZONTAL
...
}, options );
...
}
}
LayoutBox.Orientation = new Enumeration( 'HORIZONTAL', 'VERTICAL' );
// client use
const layoutBox = new LayoutBox( ..., {
orientation: LayoutBox.Orientation.VERTICAL
...
} ); |
1/10/19 dev meeting: Wave Interference and Gas Properties currently use the above proposal. Consensus is that this proposal is close enough to add to phet-software-design-patterns.md, which I'll do in phetsims/phet-info#88. |
Another convention related to Enumeration: (5) If a Property takes an Enumeration value, its validation typically looks like this: const cardinalDirectionProperty = new Property( CardinalDirection.NORTH, {
validValues: CardinalDirection.VALUES
} |
Conventions have been moved to the header comment of Enumeration.js, and are referred to in phet-software-design-patterns.md. Closing. |
Proposal for Enumeration conventions:
Orientation
, notOrientationEum
orOrientatonEnumeration
.new Enumeration( 'HORIZONTAL', 'VERTICAL' )
.The text was updated successfully, but these errors were encountered: