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

Emitter .apply() calls should use null instead of this #216

Closed
samreid opened this issue Feb 3, 2019 · 3 comments
Closed

Emitter .apply() calls should use null instead of this #216

samreid opened this issue Feb 3, 2019 · 3 comments

Comments

@samreid
Copy link
Member

samreid commented Feb 3, 2019

Discovered in phetsims/scenery#928, For unknown reasons Emitter is passing this for the apply calls. I discovered this led to a problem in SimpleDragHandler which was incorrectly using this instead of self.

@samreid samreid self-assigned this Feb 3, 2019
samreid added a commit to phetsims/scenery that referenced this issue Feb 3, 2019
@samreid
Copy link
Member Author

samreid commented Feb 3, 2019

I fixed the main problem with this, but there are still several other occurrences that will need attention.

@samreid
Copy link
Member Author

samreid commented Feb 3, 2019

I fixed the validation case. The other site that is implicitly using this = Emitter for callbacks are emit1, emit2 and emit3 which are deprecated. So perhaps that's all we need for this issue. @zepumph are you available to double check that this change is reasonable?

@zepumph
Copy link
Member

zepumph commented Feb 7, 2019

These changes look good.

I also agree that it doesn't make sense to change deprecated methods from something like:

this.activeListenersStack[ lastEntry ][ i ]( arg0, arg1, arg2 );

to

this.activeListenersStack[ lastEntry ][ i ].call( null, arg0, arg1, arg2 );

Hopefully we can update usages soon.

@zepumph zepumph closed this as completed Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants