Use Intersection Observer API for better performance #510
Labels
area-maintenance
Overall code maintenance related
platform-javascript
Related to the JavaScript version of alphaTab
AlphaTab uses a custom scroll listener for "lazy loading" the generated image chunks into the DOM for smoother UI feedback. This is based on the
getBoundingClientRect
which is very expensive as it might cause a layout flow in the browser.The intersection observer API is way more lightweight and provides exactly what we need for lazy loading.
Also this API should be used for detecting the visibility of the element on-load.
https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
The text was updated successfully, but these errors were encountered: