Web/API/PerformanceObserver/takeRecords

From Get docs


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 2The definition of 'takeRecords()' in that specification. Candidate Recommendation Initial definition of takeRecords() method.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet

takeRecords

Experimental'

Chrome

Full support 65

Edge

Full support ≤79

Firefox

Full support 60

IE

No support No

Opera

Full support Yes

Safari

No support No

WebView Android

Full support 65

Chrome Android

Full support 65

Firefox Android

Full support 60

Opera Android

Full support Yes

Safari iOS

No support No

Samsung Internet Android

Full support 9.0

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.'
Experimental. Expect behavior to change in the future.