PerformanceObserver.takeRecords()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.
La méthode takeRecords()
de l'interface PerformanceObserver
renvoie la liste actuelle des entrées de performance stockées dans l'observateur de performance, en la vidant.
Syntaxe
js
let performanceEntryList = performanceObserver.takeRecords();
Paramètres
Aucun.
Valeur de retour
Une liste d'objets PerformanceEntry
.
Exemple
js
const observer = new PerformanceObserver(function (list, obj) {
let entries = list.getEntries();
for (let i = 0; i < entries.length; i++) {
// Traiter les événements "mark" et "frame"
}
});
observer.observe({ entryTypes: ["mark", "frame"] });
let records = observer.takeRecords();
console.log(records[0].name);
console.log(records[0].startTime);
console.log(records[0].duration);
Spécifications
Specification |
---|
Performance Timeline # dom-performanceobserver-takerecords |
Compatibilité des navigateurs
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
takeRecords |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.