phetsims / vegas

Reusable game components for PhET simulations.
MIT License
1 stars 4 forks source link

convert StatusBar and its subclasses to ES6 #83

Closed pixelzoom closed 3 years ago

pixelzoom commented 3 years ago

Breaking this out of https://github.com/phetsims/tasks/issues/1044, because it's a biggish piece of work. (It's also the last piece of vegas that needs to be converted to ES6.)

StatusBar has 2 subclasses, FiniteStatusBar and InfiniteStatusBar. They both override a protected method that is called from StatusBar's constructor. This is a good example of why it's a bad idea to override anything that's called from a constructor. I was the author of StatusBar, so I'll be sure to give my former self a good talking to. And I'll self-assign this issue.

Thankfully there are no sim-specific subclasses of any of these classes.

pixelzoom commented 3 years ago

There's really very little that FiniteStatusBar and InfiniteStatusBar have in common. So reconsider whether the StatusBar superclass is even necessary.

pixelzoom commented 3 years ago

Done in 2 phases in the above commits. First I reworked the entire implementation. Then I converted to class.

Closing.