Files
react-native/Libraries/Core/setUpPerformance.js
T
George Zahariev f392ba6725 Codemod {...null} to {} in xplat/js
Summary:
Now that [exact_empty_objects has been enabled](https://fb.workplace.com/groups/flowlang/posts/1092665251339137), we can codemod `{...null}` to `{}` - they are now equivalent.

1) Run my one-off jscodeshift codemod
2) `scripts/flow/tool update-suppressions .` (as some suppressions move around due to the change)

drop-conflicts

Reviewed By: bradzacher

Differential Revision: D37834078

fbshipit-source-id: 6bf4913910e5597e5dd9d5161cd35deece6a7581
2022-07-14 17:00:28 -07:00

27 lines
638 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
*/
'use strict';
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();
};
}