vendor: 1,580 bytes, lines 1-44
1import { r as resolveElements } from './resolve-elements-CPfllwWz.js'; 2 3const thresholds = { 4 some: 0, 5 all: 1, 6}; 7function inView(elementOrSelector, onStart, { root, margin: rootMargin, amount = "some" } = {}) { 8 const elements = resolveElements(elementOrSelector); 9 const activeIntersections = new WeakMap(); 10 const onIntersectionChange = (entries) => { 11 entries.forEach((entry) => { 12 const onEnd = activeIntersections.get(entry.target); 13 /** 14 * If there's no change to the intersection, we don't need to 15 * do anything here. 16 */ 17 if (entry.isIntersecting === Boolean(onEnd)) 18 return; 19 if (entry.isIntersecting) { 20 const newOnEnd = onStart(entry.target, entry); 21 if (typeof newOnEnd === "function") { 22 activeIntersections.set(entry.target, newOnEnd); 23 } 24 else { 25 observer.unobserve(entry.target); 26 } 27 } 28 else if (typeof onEnd === "function") { 29 onEnd(entry); 30 activeIntersections.delete(entry.target); 31 } 32 }); 33 }; 34 const observer = new IntersectionObserver(onIntersectionChange, { 35 root, 36 rootMargin, 37 threshold: typeof amount === "number" ? amount : thresholds[amount], 38 }); 39 elements.forEach((element) => observer.observe(element)); 40 return () => observer.disconnect(); 41} 42 43export { inView as i }; 44//# sourceMappingURL=index-Dr1o0BAV.js.map
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.