2020-03-31 20:21:19 +03:00
|
|
|
/**
|
2021-12-31 02:08:43 +03:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2020-03-31 20:21:19 +03:00
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*
|
2020-07-22 19:43:45 +03:00
|
|
|
* @flow strict
|
2020-03-31 20:21:19 +03:00
|
|
|
* @format
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
if (!global.performance) {
|
2022-05-05 02:13:07 +03:00
|
|
|
global.performance = ({...null}: {now?: () => number});
|
2020-03-31 20:21:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a double, measured in milliseconds.
|
|
|
|
* https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
|
|
|
|
*/
|
|
|
|
if (typeof global.performance.now !== 'function') {
|
2021-11-03 08:10:46 +03:00
|
|
|
global.performance.now = function () {
|
2020-03-31 20:21:19 +03:00
|
|
|
const performanceNow = global.nativePerformanceNow || Date.now;
|
|
|
|
return performanceNow();
|
|
|
|
};
|
|
|
|
}
|