react-stick
react-stick copied to clipboard
Add an option to disable tracking
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:
- idleCallback (default)
- animationFrame
- 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.