PerformanceObserver.takeRecords()

 

The takeRecords() method of the PerformanceObserver interface returns the current list of performance entries stored in the performance observer, emptying it out.

Syntax

observer.takeRecords();

Parameters

None.

Return value

A list of PerformanceEntry objects.

Example

var observer = new PerformanceObserver(function(list, obj) {
  var entries = list.getEntries();
  for (var i=0; i < entries.length; i++) {
    // Process "mark" and "frame" events
  }
});
observer.observe({entryTypes: ["mark", "frame"]});
var records = observer.takeRecords();
console.log(records[0].name);
console.log(records[0].startTime);
console.log(records[0].duration);

Specifications

Specification Status Comment
Performance Timeline Level 2
The definition of 'takeRecords()' in that specification.
Candidate Recommendation Initial definition of takeRecords() method.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) 60 (60) No support (Yes) No support
Available on workers (Yes) (Yes) No support (Yes) No support
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support No support (Yes) 60.0 (60) No support

(Yes)

No support
Available on workers No support (Yes) (Yes) No support

(Yes)

No support

 

Document Tags and Contributors

Contributors to this page: Claas, jamietre, chrisdavidmills
Last updated by: Claas,