Localisation updates from https://translatewiki.net.
[mediawiki.git] / resources / lib / codex / modules / useIntersectionObserver.cjs
bloba345d8d1f78bee20430b19b3033548a36a4d23ec
1 "use strict";const t=require("vue");function u(o,c){const e=t.ref(!1);let i=!1;if(typeof window!="object"||!("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype))return e;const n=new window.IntersectionObserver(r=>{const s=r[0];s&&(e.value=s.isIntersecting)},c);return t.onMounted(()=>{i=!0,o.value&&n.observe(o.value)}),t.onUnmounted(()=>{i=!1,n.disconnect()}),t.watch(o,r=>{i&&(n.disconnect(),e.value=!1,r&&n.observe(r))}),e}module.exports=u;