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

Is it possible to use Passive Event Listeners to improve performance? #38

Closed
ARDde opened this issue May 23, 2019 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@ARDde
Copy link

ARDde commented May 23, 2019

In trackWindowScroll.js you are using normal event listeners. If you use Passive Event Listeners you get a better performance on scrolling:

https://developers.google.com/web/updates/2016/06/passive-event-listeners

All you have to do is to add a third parameter (true) to the listener.

Example:
window.addEventListener('resize', this.delayedScroll, true);

Best regards
Marcel

@Aljullu
Copy link
Owner

Aljullu commented May 25, 2019

Hi @ARDde, this sounds like a good addition. I guess you really meant this, right?

 window.addEventListener('resize', this.delayedScroll, { passive: true });

I added this setting in 1fb0c29 and it should be included in the next release.

Thank you for the suggestion!

@Aljullu Aljullu added the enhancement New feature or request label May 25, 2019
@Aljullu
Copy link
Owner

Aljullu commented Oct 5, 2019

I released a beta version which includes this improvement. Feel free to test it and provide feedback or report bugs if you find them.

You can install it with:

npm i --save react-lazy-load-image-component@1.4.0beta.0

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

No branches or pull requests

2 participants