Expose PerformanceObserver related classes in the global scope (#45539)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45539

Changelog: [internal]

This exposes several classes (interfaces in the spec lingo) related to the Performance API to the global scope, so users can access them directly to do things like refinements using `instanceof`. This also prevents the need from importing the modules from `react-native` directly, which would prevent code sharing with Web.

Reviewed By: rshest

Differential Revision: D59859654

fbshipit-source-id: e1f7afb0c98b394b1f97c3790db2e570e6ba0cd9
This commit is contained in:
Rubén Norte
2024-07-22 04:45:02 -07:00
committed by Facebook GitHub Bot
parent a5bd64ece8
commit 2551aee4b0
@@ -16,3 +16,51 @@ polyfillGlobal(
require('../../src/private/webapis/performance/PerformanceObserver')
.default,
);
polyfillGlobal(
'PerformanceObserverEntryList',
() =>
require('../../src/private/webapis/performance/PerformanceObserver')
.PerformanceObserverEntryList,
);
polyfillGlobal(
'PerformanceEntry',
() =>
require('../../src/private/webapis/performance/PerformanceEntry')
.PerformanceEntry,
);
polyfillGlobal(
'PerformanceMark',
() =>
require('../../src/private/webapis/performance/UserTiming').PerformanceMark,
);
polyfillGlobal(
'PerformanceMeasure',
() =>
require('../../src/private/webapis/performance/UserTiming')
.PerformanceMeasure,
);
polyfillGlobal(
'PerformanceEventTiming',
() =>
require('../../src/private/webapis/performance/EventTiming')
.PerformanceEventTiming,
);
polyfillGlobal(
'TaskAttributionTiming',
() =>
require('../../src/private/webapis/performance/LongTasks')
.TaskAttributionTiming,
);
polyfillGlobal(
'PerformanceLongTaskTiming',
() =>
require('../../src/private/webapis/performance/LongTasks')
.PerformanceLongTaskTiming,
);