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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
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.
PerformanceObserver.takeRecords() by Mozilla Contributors is licensed under CC-BY-SA 2.5.