1export function initialize(lastIndicator, instance) { 2 const options = { 3 root: findClosestScrollContainer(lastIndicator), 4 rootMargin: "0px", 5 threshold: 0 6 } 7 8 const observer = new IntersectionObserver(async entries => { 9 for (const entry of entries) { 10 if (entry.isIntersecting) { 11 await instance.invokeMethodAsync("LoadMoreItems") 12 } 13 } 14 }, options) 15 16 observer.observe(lastIndicator) 17 18 return { 19 dispose: () => infiniteScollingDispose(observer), 20 onNewItems: () => { 21 observer.unobserve(lastIndicator) 22 observer.observe(lastIndicator) 23 } 24 } 25} 26 27function findClosestScrollContainer(element) { 28 while (element) { 29 const style = getComputedStyle(element) 30 if (style.overflowY !== "visible") { 31 return element 32 } 33 34 element = element.parentElement 35 } 36 37 return null 38} 39 40function infiniteScollingDispose(observer) { 41 observer.disconnect() 42}
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.