phetsims / joist

Joist is the main framework for PhET Interactive Simulations. Joist creates and displays the simulation content, home screen, navigation bar, About dialog, enables switching between tabs, and other framework-related features.
MIT License
8 stars 6 forks source link

JoistButton calls `super` followed immediately by `mutate`? #824

Closed pixelzoom closed 2 years ago

pixelzoom commented 2 years ago

In JoistButton.ts:

    super();

    // We want to mutate eagerly, but must do so after initializing Voicing properties
    this.mutate( options );

Is it really necessary to call super without options, immediately followed by mutate?

If so... It should be documented, because it's really confusing, and really odd. (No, I don't understand the existing comment, and it's not sufficient.) And I would definitely reconsider whatever design decision caused this to be necessary.

zepumph commented 2 years ago

This is vestigial, and the hackary is no longer needed since updating our mixins to Typescript. The options can be passed directly to super. Let me know if you see any other cases like this!

pixelzoom commented 2 years ago

👍🏻 Closing.