phetsims/axon

Hmm… I didn’t realize that timer.js was a step timer. That’s now clear with the rename. But then I have a potential problem in NS PlayButtonGroup:

          stepTimer.runOnNextFrame( () => {
            addAMateButton.visible = ( bunnyCount === 1 );
            playButton.visible = ( bunnyCount > 1 );
          } );

This code assumes that it will be run on the next next frame, not on the next step. And I think that’s a valid assumption based on the name. But now I see this (new?) documentation in stepTimer.js:

... Only runs when the sim is active, during the step. ...

So 2 questions:

(1) Can we do something about this misleading runOnNextFrame name?
(2) How do I run something on the next frame, regardless of whether this sim is playing/paused.

Latest posts