BoundingClientRectCache
Index
Constructors
Methods
Constructors
constructor
- Returns BoundingClientRectCache
Methods
publicgetOrAdd
- Get or add a DOMRectCached instance for a specified - element.- Parameters- element: HTMLElement- HTMLElement to get a DOMRectCached instance for. 
- timeInMsToNextRefresh: number = 300- Optional. Defaults to 300. If the instance, returned by this method, already exists in the cache. Then DomRectCached.refresh method on the instance is called automatically if - timeInMsToNextRefresh = 0. Useful when DomRectCached should be refreshed immediatly.
- timeInMsToNextRefresh > 0 && performance.now() - instance.lastRefreshInMs > timeInMsToNextRefresh
 - This means that if - timeInMsToNextRefresh < 0then DomRectCached.refresh will never be called. This can be useful when we never want to refresh the DomRectCached instance.
 - Returns DOMRectCached- A DOMRectCached element. 
Cache for bounding client rectangles. This is useful when cost of
HTMLElement.getBoundingClientRect()becomes a problem (it causes browser reflow which in some situations can be very costly). By caching the information from theDOMRect, this cost can be avoided.