mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
059184e7ce
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35901 [Changelog][Internal] Partially reverts the change that was redirecting `performance` instance to the new implementation in WebPerformance, until the actual implementation becomes public and native modules are included by default. Reviewed By: rubennorte Differential Revision: D42607379 fbshipit-source-id: c1ce995d20b9dfe7aef8436cea00d89b81e32932
25 lines
623 B
JavaScript
25 lines
623 B
JavaScript
/**
|
|
* 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
|
|
* @format
|
|
*/
|
|
|
|
if (!global.performance) {
|
|
global.performance = ({}: {now?: () => number});
|
|
}
|
|
|
|
/**
|
|
* Returns a double, measured in milliseconds.
|
|
* https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
|
|
*/
|
|
if (typeof global.performance.now !== 'function') {
|
|
global.performance.now = function () {
|
|
const performanceNow = global.nativePerformanceNow || Date.now;
|
|
return performanceNow();
|
|
};
|
|
}
|