Web APIs

IntersectionObserver.takeRecords()

Try the free JavaScript compiler

Drain intersection entries that are queued but not yet delivered to the callback. It does not force a fresh layout or intersection calculation. Example console output: 0.

Formal Syntax & Structure

javascript syntaxjavascript
observer.takeRecords()

Return Value

IntersectionObserverEntry[]

Queued entries.

Working Example

Example Snippetjavascript
const o=new IntersectionObserver(()=>{}); console.log(o.takeRecords().length); o.disconnect();
JavaScript Reference