Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Make event handlers passive #2111

Closed
gemfarmer opened this issue Oct 26, 2016 · 2 comments
Closed

Make event handlers passive #2111

gemfarmer opened this issue Oct 26, 2016 · 2 comments

Comments

@gemfarmer
Copy link
Contributor

gemfarmer commented Oct 26, 2016

Expected Behavior

Event handlers should not trigger or slow down the main thread when they are not in use

Actual Behavior

screen shot 2016-10-26 at 9 43 10 am

## Steps to reproduce the behavior

Currently, support for passive only exists in native implementations of JS, so all of our D3 event handlers would need to be changed to work with the JS web API

Can i use shows that only some browsers support passive event handlers, the important caveats here being that:

  1. chrome and firefox support passive event listeners.
  2. 'passive: true' will be most effective in desktop views where the screen will be resized more frequently. Although passive event handlers don't directly help optimize resize events, these events push the limit of the main thread, and force the user closer to the threshold where they experience lag. Any optimization here is beneficial.
  3. If a browser doesn't support passive event listeners, it will be the same as it is now. We will ONLY see performance improvements

screen shot 2016-10-26 at 9 50 39 am

Resources:

@gemfarmer
Copy link
Contributor Author

This is seriously starting to bug me.
I forked the stickyfill repo here.

Next attempt will be to modify the event listeners in that repo to passive and see if there is a marked improvement.

@gemfarmer
Copy link
Contributor Author

Fixed with #2129

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant