[5.5] Use listensFor instead of hears for event listener self-registration #19962
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I love the new feature introduced in #19917 and I wanted to make a naming suggestion, but I didn't see it until it was merged. There was a bit of discussion on that PR, but I'm sure Taylor and Mohammed get enough alerts without reading through closed PRs so I figured opening a new one would be the best way to propose it.
Here's my reasoning for the change copied from that thread: The reason I prefer
$listensFor
instead of$hears
is that$listensFor
is more active; it describes something that the object is actively doing, whereas$hears
feels more passive. If I say I "hear" a particular sound, you would assume that I happen to be in the area when some sound is occurring. If I say I "listen for" a particular sound, you would assume that I am actively attentive while waiting for that sound to occur. We're setting up objects that specifically listen for certain events (and actively wait for them to occur), not just that hear the event activity around them.@adamwathan , would love to hear your thoughts since you introduced the feature. Of course, close away if this seems too pedantic, but I find naming to worth a discussion since it's both difficult and important. I'll still use and enjoy the feature regardless, but I might scoff a bit when I add my listeners array 😄