Web APIs

PerformanceObserver.takeRecords()

Try the free JavaScript compiler

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();
JavaScript Reference