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

var PerformanceEntry[] = performanceObserver.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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
takeRecords
Experimental
Chrome Full support 65Edge ? Firefox Full support 60IE No support NoOpera Full support YesSafari No support NoWebView Android Full support 65Chrome Android Full support 65Firefox Android Full support 60Opera Android Full support YesSafari iOS No support NoSamsung Internet Android ?

Legend

Full support Ā 
Full support
No support Ā 
No support
Compatibility unknown Ā 
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.