mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
4e7155ee53
Summary: In bridgeless mode we don't want to set up the batched bridge, which is set up as part of InitializeCore. Instead of deleting InitializeCore completely, let's just skip this step if we're in bridgeless mode, which we'll detect using a global variable set on the runtime from cpp (`RN$Bridgeless`). This way you still get an error if the bridge is somehow not set up properly when you're not in bridgeless mode (it won't fail silently). Reviewed By: fkgozali Differential Revision: D15721940 fbshipit-source-id: 73896e25874dd000f37d1abc9cf6be549ab3434f
58 lines
1.9 KiB
JavaScript
58 lines
1.9 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its 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';
|
|
|
|
/**
|
|
* We don't set up the batched bridge in bridgeless mode. Once we've migrated
|
|
* everything over to bridgeless we can just delete this file.
|
|
*/
|
|
if (!global.RN$Bridgeless) {
|
|
/**
|
|
* Set up the BatchedBridge. This must be done after the other steps in
|
|
* InitializeCore to ensure that the JS environment has been initialized.
|
|
* You can use this module directly, or just require InitializeCore.
|
|
*/
|
|
const BatchedBridge = require('../BatchedBridge/BatchedBridge');
|
|
BatchedBridge.registerLazyCallableModule('Systrace', () =>
|
|
require('../Performance/Systrace'),
|
|
);
|
|
BatchedBridge.registerLazyCallableModule('JSTimers', () =>
|
|
require('./Timers/JSTimers'),
|
|
);
|
|
BatchedBridge.registerLazyCallableModule('HeapCapture', () =>
|
|
require('../HeapCapture/HeapCapture'),
|
|
);
|
|
BatchedBridge.registerLazyCallableModule('SamplingProfiler', () =>
|
|
require('../Performance/SamplingProfiler'),
|
|
);
|
|
BatchedBridge.registerLazyCallableModule('RCTLog', () =>
|
|
require('../Utilities/RCTLog'),
|
|
);
|
|
BatchedBridge.registerLazyCallableModule('RCTDeviceEventEmitter', () =>
|
|
require('../EventEmitter/RCTDeviceEventEmitter'),
|
|
);
|
|
BatchedBridge.registerLazyCallableModule('RCTNativeAppEventEmitter', () =>
|
|
require('../EventEmitter/RCTNativeAppEventEmitter'),
|
|
);
|
|
BatchedBridge.registerLazyCallableModule('GlobalPerformanceLogger', () =>
|
|
require('../Utilities/GlobalPerformanceLogger'),
|
|
);
|
|
BatchedBridge.registerLazyCallableModule('JSDevSupportModule', () =>
|
|
require('../Utilities/JSDevSupportModule'),
|
|
);
|
|
|
|
if (__DEV__ && !global.__RCTProfileIsProfiling) {
|
|
BatchedBridge.registerCallableModule(
|
|
'HMRClient',
|
|
require('../Utilities/HMRClient'),
|
|
);
|
|
}
|
|
}
|