Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Improving scrolling performance with passive listeners? #207

Open
mikkopori opened this issue Mar 29, 2022 · 1 comment
Open

Improving scrolling performance with passive listeners? #207

mikkopori opened this issue Mar 29, 2022 · 1 comment

Comments

@mikkopori
Copy link

Hello,

Google Lighthouse recommends using passive listener to improve performance. Please consider the following change:

  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      this.autoPanIsRunning = true;
      requestAnimationFrame(this.autoPanLoop);
      this.ViewerDOM.addEventListener('wheel', this.onWheel, false);
    }
  }, {

would need to be set as passive

  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      this.autoPanIsRunning = true;
      requestAnimationFrame(this.autoPanLoop);
      this.ViewerDOM.addEventListener('wheel', this.onWheel, false, {passive: true});
    }
  }, {

https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners
https://web.dev/uses-passive-event-listeners/?utm_source=lighthouse&utm_medium=devtools

Br,

Mikko

@echosing54
Copy link

Has this change been implemented yet?

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

No branches or pull requests

2 participants