mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Implement durationThreshold option for PerformanceObserver (#36152)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36152 [Changelog][Internal] By [the W3C standard](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/observe), `PerformanceObserver.observer` can optionally take a `durationThreshold` option, so that only entries with duration larger than the threshold are reported. This diff adds support for this on the RN side, as well as unit tests for this feature on the JS side. NOTE: The standard suggests that default value for this is 104s. I left it at 0 for now, as for the RN use cases t may be to too high (needs discussion). Reviewed By: rubennorte Differential Revision: D43154319 fbshipit-source-id: 0f9d435506f48d8e8521e408211347e8391d22fc
This commit is contained in:
committed by
Facebook GitHub Bot
parent
581357bc9b
commit
cf194aebfe
@@ -59,4 +59,12 @@ NativePerformanceObserver::getEventCounts(jsi::Runtime &rt) {
|
||||
eventCounts.begin(), eventCounts.end());
|
||||
}
|
||||
|
||||
void NativePerformanceObserver::setDurationThreshold(
|
||||
jsi::Runtime &rt,
|
||||
int32_t entryType,
|
||||
double durationThreshold) {
|
||||
PerformanceEntryReporter::getInstance().setDurationThreshold(
|
||||
static_cast<PerformanceEntryType>(entryType), durationThreshold);
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
Reference in New Issue
Block a user