/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/Libraries/Core/setUpPerformance.js
30 строк
934 B
Rubén Norte
Set up modern performance APIs if the native module is available (#53431)
01 сен 2025, 19:18
01 сен 2025, 19:18
727caca
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format */ import setUpPerformanceModern from '../../src/private/setup/setUpPerformanceModern'; import NativePerformance from '../../src/private/webapis/performance/specs/NativePerformance'; // In case if the native implementation of the Performance API is available, use it, // otherwise fall back to the legacy/default one, which only defines 'Performance.now()' if (NativePerformance) { setUpPerformanceModern(); } else { if (!global.performance) { // $FlowExpectedError[cannot-write] global.performance = { mark: () => {}, measure: () => {}, now: () => { const performanceNow = global.nativePerformanceNow || Date.now; return performanceNow(); }, }; } }