Web APIs
PerformanceObserver.takeRecords()
Retrieve and drain buffered performance entries for this observer without waiting for callback delivery. Example console output: queued 0.
Formal Syntax & Structure
javascript syntaxjavascript
observer.takeRecords()Return Value
PerformanceEntry[]
Drained observer buffer.
Working Example
Example Snippetjavascript
const o=new PerformanceObserver(()=>{}); o.observe({entryTypes:["mark"]}); performance.mark("queued"); console.log(o.takeRecords()[0].name,o.takeRecords().length); o.disconnect();