fkhadra / react-on-screen

Check if a react component in the viewport
https://fkhadra.github.io/react-on-screen/
MIT License
405 stars 50 forks source link

Use Passive Event Listeners #11

Closed damusnet closed 6 years ago

damusnet commented 6 years ago

Hi,

Thank you for open sourcing what seems to be a great library!

Have you considered leveraging Passive Event Listeners, and making it available as an option?

See https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md

Correct me if I'm wrong, but given window.addEventListener("scroll", this.throttleCb); this is currently not an option.

Also, do you have any feedback on how this library performs on a low end smartphone when used in several places on the same page?

damusnet commented 6 years ago

Mmmmh, actually, I just realized Passive Event Listeners seem to be specific to touch and wheel events, so it might not be relevant for scroll and resize events at all.