Specifies types of performance events to observe and starts observing. The callback function set when creating the PerformanceObserver
will be invoked when a matching
PerformanceEntry
is received.
A string list of identifiers for the PerformanceEntry
to be observed.
You can use entryType or entryType.name as identifiers. For example, you can use "metric"
to listen to performance events for the entire metric type,
including MetricFcpEntry
and MetricActualFmpEntry
. Alternatively, you can use "metric.fcp"
to listen only to the MetricFcpEntry
performance event.
Refer to PerformanceEntry.entryType
and PerformanceEntry.name
for available types
and names. Unrecognized types will be ignored. If no valid types are found, observe()
will not function.
It is recommended to call this method during initialization, such as in the constructor of a root component or within the useMemo
Hook,
to ensure it is called as early as possible when the component or page loads, to avoid missing any data.
None (undefined
)
This example creates a PerformanceObserver
that observes the entire PerformanceEntry
of types through ["metric", "pipeline"]
.
This example creates a PerformanceObserver
that observes MetricFcpEntry
and the entire PerformanceEntry
of type pipeline
through ["metric.fcp", "pipeline"]
.
LCD tables only load in the browser