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

Add an option to disable tracking #155

Open
yakunins opened this issue Sep 17, 2020 · 0 comments
Open

Add an option to disable tracking #155

yakunins opened this issue Sep 17, 2020 · 0 comments

Comments

@yakunins
Copy link
Contributor

yakunins commented Sep 17, 2020

Hi @frontendphil

The main idea here is that user may turn on and off tracking if react-stick is placed outside the viewport (with his own preferred technique).

Proposal

Add property disableTracking to allow user disable tracking.

Or, which is worse from compatibility POV, rename property updateOnAnimationFrame to updateOn with values:

  1. idleCallback (default)
  2. animationFrame
  3. never

Why?

Right now watcher constantly tracks position of the anchor, taking up to 50% CPU performance in idleCallbacks in case of 200 react-stick instances (on my PC). Even if node itself is hidden (null)!

This may be seen straight on demo page. In case sticky node visible CPU usage goes twice higher.

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

1 participant