Lib: Add comment to lazyload.ts

This commit is contained in:
2024-12-16 18:17:54 +01:00
parent 3cffab193b
commit df0402a318

View File

@ -14,7 +14,12 @@ const getObserver = () => {
}); });
}; };
// This is used as an action on lazyloaded elements /**
* Use this as an action on elements that should be only loaded when moved into view.
* Note that if the element's size is 0 on mount, multiple elements could be in-view that
* would be out-of-view with their correct size.
* This happens for <div> elements without content for example.
*/
export const lazyload = (node: HTMLElement) => { export const lazyload = (node: HTMLElement) => {
// The observer determines if the element is visible on screen // The observer determines if the element is visible on screen
getObserver(); getObserver();