Web APIs
IntersectionObserver.disconnect()
Stop observing every registered target. Previously queued entries may still exist; takeRecords() can drain them. Example console output: false.
Formal Syntax & Structure
javascript syntaxjavascript
observer.disconnect()Return Value
undefined
No result value.
Working Example
Example Snippetjavascript
(async () => {const a=document.createElement("div"); document.body.append(a); let called=false; const o=new IntersectionObserver(()=>called=true); o.observe(a); o.disconnect(); await new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r))); console.log(called);})()