-
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
Eliminate frameStartedEmitter and frameEndedEmitter #534
Comments
You haven't provided enough info here. Is |
More questions... |
And can you please summarize why this replacement is needed? I don't have time to distill that info out of phetsims/phet-io#1383. |
I looked at (1) Emitter takes a (2) If Emitter's |
PhET-iO playback and record warranted introduction of Let's discuss |
It sounds like you further hypothesized that no one needs |
I don't understand why |
It may well be the case that we can get away with performing EqEx's callback at the end of the frame. That's not the point. The point is that the callback is work that should semantically be done before the first step, and doing it before the first step ensures that it's future proof. And the general issue is not whether EqEx can be changed or not. The issue is that there is a legitimate need to have this functionality, and that the proposal here does not meet that need. |
The documentation for that listener says // Things to do after the sim has loaded, when this Node has a valid location. So perhaps adding a listener to |
I don't know. The doc tells me that
|
Continuing discussion of |
It looks like the |
Yes, it should use |
Since PhET-iO seems to have a legitimate use of |
From this it may be nice to document a preferred way to add a listener to a frame. Which emitter should be used by default? Is the visibility annotation and documentation clear enough for all of them? |
I think most simulations should add a listener by implementing |
@samreid said:
Is something like this what you had in mind? class MyScreenView extends ScreenView {
constructor(...) {
this.isInitialized = false;
...
}
step: dt => {
if ( !this.isInitialized ) {
this.isInitialized = true;
// do some view initialization
}
...
}
} CM: I edited the above example. |
Yes, but this is broader than just doing something on the first try. Normal models and views implement step like this: From Balancing Act: // Step function, called by the framework, clocks time-dependent behavior.
step: function( dt ) {
this.plank.step( dt );
this.massList.forEach( function( mass ) {
mass.step( dt );
} );
}, From Hooke's Law: step: function( dt ) {
this.animator.step( dt );
} Hooking into |
@samreid said:
I agree with the first sentence, but not the second. It would have been "possible" to use |
How about "When that is impossible or relatively awkward..."? |
Looks really good. Thank you both. |
From https://github.com/phetsims/phet-io/issues/1383, we would like to eliminate frameStartedEmitter and frameEndedEmitter, and replace usages with
stepSimulationEmitter
(we would make that public).There are 4 usages of frameStartedEmitter and 3 usages of frameEndedEmitter which would be good to convert, if possible.
The text was updated successfully, but these errors were encountered: