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

perf: subscribe to the browser event only when attaching images #217

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

negezor
Copy link

@negezor negezor commented Jun 27, 2024

Summary

Currently, we subscribe to the browser events click, keyup, scroll, and resize every time the mediumZoom function is called, which also happens during clone. Instead of always being subscribed to these events, it is much better to subscribe only when necessary. These events stack up on each other, significantly affecting performance and preventing the browser from garbage collecting. This is especially important in SPA applications when we use a component-based approach.

Result

No performance degradation when images are missing or not active.

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

Successfully merging this pull request may close these issues.

1 participant