PerformanceObserver π§ͺ
Canary π§ͺ
This API is currently only available in React Nativeβs Canary and Experimental channels.
If you want to try it out, please enable the Canary Channel in your app.
The global PerformanceObserver class, as defined in Web specifications.
Exampleβ
ts
const observer =newPerformanceObserver(
(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.