react-stick icon indicating copy to clipboard operation
react-stick copied to clipboard

Add an option to disable tracking

Open yakunins opened this issue 5 years ago • 0 comments

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.

yakunins avatar Sep 17 '20 15:09 yakunins