Skip to content
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

why was 'on' changed to 'lazyLink'? #254

Closed
pixelzoom opened this issue May 29, 2020 · 2 comments
Closed

why was 'on' changed to 'lazyLink'? #254

pixelzoom opened this issue May 29, 2020 · 2 comments
Assignees

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented May 29, 2020

In a50707b for phetsims/scenery#490, @jonathanolson made this change in ConcentrationMeterNode.js:

-     solutionNode.on( 'bounds', updateValue );
-     stockSolutionNode.on( 'bounds', updateValue );
-     solventFluidNode.on( 'bounds', updateValue );
-     drainFluidNode.on( 'bounds', updateValue );
+     solutionNode.boundsProperty.lazyLink( updateValue );
+     stockSolutionNode.boundsProperty.lazyLink( updateValue );
+     solventFluidNode.boundsProperty.lazyLink( updateValue );
+     drainFluidNode.boundsProperty.lazyLink( updateValue );

And in phetsims/scenery#490 (comment), @zepumph asked why on was changed to lazyLink instead of link. I'm interested in the answer.

@jonathanolson
Copy link
Contributor

It's because I was going for compatibility, and since .on() only added the listener without calling it, lazyLink is the appropriate thing to change it to.

@pixelzoom
Copy link
Contributor Author

Great, thanks for clarifying. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants