Web APIs
MutationObserver.disconnect()
Stop this observer from receiving future mutation notifications and discard its queued records. Call observe() to start again. Example console output: 0.
Formal Syntax & Structure
javascript syntaxjavascript
observer.disconnect()Return Value
undefined
No result value.
Working Example
Example Snippetjavascript
const p=document.createElement("p"); const o=new MutationObserver(()=>{}); o.observe(p,{attributes:true}); p.id="x"; o.disconnect(); console.log(o.takeRecords().length);