PerformanceObserver 🧪
Experimental 🧪
This API is experimental. Experimental APIs may contain bugs and are likely to change in a future version of React Native. Don't use them in production.
The global PerformanceObserver
class, as defined in Web specifications.
Example​
ts
const observer = new PerformanceObserver(
(list, observer, options) => {
for (const entry of list.getEntries()) {
console.log(
'Received entry with type',
entry.entryType,
'and name',
entry.name,
'that started at',
entry.startTime,
'and took',
entry.duration,
'ms',
);
}
},
);
observer.observe({entryTypes: ['mark', 'measure']});
Reference
Constructor​
PerformanceObserver()
​
See documentation in MDN.
Static properties​
supportedEntryTypes
​
See documentation in MDN.
Returns ['mark', 'measure', 'event', 'longtask']
.
Instance methods​
observe()
​
See documentation in MDN.
disconnect()
​
See documentation in MDN.