szager-chromium / IntersectionObserver

API Sketch for Intersection Observers
Apache License 2.0
6 stars 6 forks source link

Proposal: add throttleFrequency flag, and make trackVisibility depend on it #1

Closed szager-chromium closed 6 years ago

szager-chromium commented 6 years ago

As a way to discourage developers from enabling occlusion detection -- which is likely to be expensive to compute and may negatively affect page performance -- unless they really need it, maybe we should also add a throttleFrequency flag to IntersectionObserverInit, with the following behavior:

throttleFrequency: if true, then observations are computed no more frequently than once per 100ms.

trackVisibility: if true, and if throttleFrequency is true, then compute and report occlusion detection. If throttleFrequency is false, then this option is ignored.

ojanvafai commented 6 years ago

Nit: should we throw instead of ignoring when setting trackVisibility and throttleFrequency is false?

szager-chromium commented 6 years ago

Implemented this with the 'delay' option.