MCPcopy Create free account
hub / github.com/google/agents-cli / whenInView

Function whenInView

docs/src/javascripts/lifecycle.js:65–83  ·  view source on GitHub ↗
(el, fn)

Source from the content-addressed store, hash-verified

63
64 // ── Lazy: only fire when the element scrolls into view ──────────────────
65 function whenInView(el, fn) {
66 if (!el) return;
67 if (REDUCED) {
68 fn();
69 return;
70 }
71 const obs = new IntersectionObserver(
72 (entries) => {
73 entries.forEach((e) => {
74 if (e.isIntersecting) {
75 obs.disconnect();
76 fn();
77 }
78 });
79 },
80 { rootMargin: "0px 0px -10% 0px" }
81 );
82 obs.observe(el);
83 }
84
85 // Helper: build an SVG element from a string template.
86 function svgEl(tag, attrs) {

Callers 6

initTranscriptFunction · 0.85
initLoopFunction · 0.85
initFailureMuseumFunction · 0.85
initTeamFunction · 0.85
initTraceFunction · 0.85
initRollingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected