mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
789912441e
Summary: It doesn't make sense to have checks for whether we're profiling or not in `__DEV__` blocks, where we shouldn't be profiling in the first case. We're going to remove the `global.__RCTProfileIsProfiling` flag in favor of a function that checks if we're profiling in real time (as opposed to checking if we're profiling only on startup, which is what that value does). This is just to make that migration easier without having to migrate callsites that are bad practices anyway. Changelog: [internal] Reviewed By: rshest Differential Revision: D40095841 fbshipit-source-id: ba6cdf4bef8a4c169c50a974671c21144ccee92b
60 lines
2.0 KiB
JavaScript
60 lines
2.0 KiB
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-local
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
let registerModule;
|
|
if (global.RN$Bridgeless === true && global.RN$registerCallableModule) {
|
|
registerModule = global.RN$registerCallableModule;
|
|
} else {
|
|
const BatchedBridge = require('../BatchedBridge/BatchedBridge');
|
|
registerModule = (
|
|
moduleName:
|
|
| $TEMPORARY$string<'GlobalPerformanceLogger'>
|
|
| $TEMPORARY$string<'HMRClient'>
|
|
| $TEMPORARY$string<'HeapCapture'>
|
|
| $TEMPORARY$string<'JSTimers'>
|
|
| $TEMPORARY$string<'RCTDeviceEventEmitter'>
|
|
| $TEMPORARY$string<'RCTLog'>
|
|
| $TEMPORARY$string<'RCTNativeAppEventEmitter'>
|
|
| $TEMPORARY$string<'SamplingProfiler'>
|
|
| $TEMPORARY$string<'Systrace'>,
|
|
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by
|
|
* Flow's LTI update could not be added via codemod */
|
|
factory,
|
|
) => BatchedBridge.registerLazyCallableModule(moduleName, factory);
|
|
}
|
|
|
|
registerModule('Systrace', () => require('../Performance/Systrace'));
|
|
if (!(global.RN$Bridgeless === true)) {
|
|
registerModule('JSTimers', () => require('./Timers/JSTimers'));
|
|
}
|
|
registerModule('HeapCapture', () => require('../HeapCapture/HeapCapture'));
|
|
registerModule('SamplingProfiler', () =>
|
|
require('../Performance/SamplingProfiler'),
|
|
);
|
|
registerModule('RCTLog', () => require('../Utilities/RCTLog'));
|
|
registerModule(
|
|
'RCTDeviceEventEmitter',
|
|
() => require('../EventEmitter/RCTDeviceEventEmitter').default,
|
|
);
|
|
registerModule('RCTNativeAppEventEmitter', () =>
|
|
require('../EventEmitter/RCTNativeAppEventEmitter'),
|
|
);
|
|
registerModule('GlobalPerformanceLogger', () =>
|
|
require('../Utilities/GlobalPerformanceLogger'),
|
|
);
|
|
|
|
if (__DEV__) {
|
|
registerModule('HMRClient', () => require('../Utilities/HMRClient'));
|
|
} else {
|
|
registerModule('HMRClient', () => require('../Utilities/HMRClientProdShim'));
|
|
}
|