camwiegert/in-view

Add passive events support

joeyhoer opened this issue · 2 comments

By passing the passive: true option to the addEventListener call you can inform the browser that the callback won't preventDefault(). This has noticeable performance benefits -- see https://developers.google.com/web/updates/2016/06/passive-event-listeners

@joeyhoer Interesting idea. If I understand correctly, though, this optimization shouldn't affect scroll events as they can't be preventDefault()'d.

So, this would only affect our resize and load listeners. The load listener shouldn't be much of a factor. Is it worth it to feature-detect this for resize events if they're already throttled, then?

I'm going to close this for now. I'm open to reopening it if there's a good argument for it eventually.