Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: support passive event listeners #186

Merged

Conversation

janczizikow
Copy link
Collaborator

Added support for passive event listeners to improve scroll performance.
This PR is pretty much based of @undirectlookable's PR.
I thought it might be a good addition and the previous PR went spooky quiet, thus I opened this one.

The feature detection util function is taken from MDN.
Reference: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Improving_scrolling_performance_with_passive_listeners

P.S.:

  1. wow, I just realized that all those changes actually are all taken from other source... hahah 😆
  2. I noticed a window.removeEventListener call in componentWillUnmount lifecycle. I was wondering why it's there, since there's no other place where there's window.addEventListener. The only scenario I could think of is someone changing the parent prop to a function which returns different element from previous prop.

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

Successfully merging this pull request may close these issues.

1 participant