wiki.techinc.nl/resources/lib/codex/modules/useIntersectionObserver.cjs
Eric Gardner bc07829e7b Update Codex from v1.2.1 to v1.3.0
Also introduces a new design token (@border-color-muted) and
updates some resource module definitions to use .cjs filenames
per upstream.

Bug: T324688
Bug: T338184
Bug: T338802
Bug: T346815
Bug: T349016
Bug: T350197
Bug: T352585
Bug: T352931
Bug: T354547
Bug: T354759
Bug: T355081
Bug: T355160
Bug: T355551
Change-Id: Idcfdee4583018500d06e37fda2ee4925111f1915
2024-01-23 14:03:05 -08:00

1 line
529 B
JavaScript

"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;