1let sharedObserver = null; 2 3function getObserver() { 4 if (!sharedObserver) { 5 sharedObserver = new IntersectionObserver( 6 (entries) => { 7 for (const entry of entries) { 8 if (entry.isIntersecting) { 9 entry.target.classList.add('is-visible'); 10 sharedObserver.unobserve(entry.target); 11 } 12 } 13 }, 14 { threshold: 0.1, rootMargin: '0px 0px 100px 0px' } 15 ); 16 } 17 return sharedObserver; 18} 19 20export function observeFadeIn(elements) { 21 const observer = getObserver(); 22 elements.forEach((el) => { 23 if (el.classList && el.classList.contains('fade-in')) observer.observe(el); 24 }); 25} 26 27export function initFadeIn(root = document) { 28 observeFadeIn(Array.from(root.querySelectorAll('.fade-in'))); 29}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.