Use registerLazyCallableModule to register HMRClient

Summary:
Right now we use `BatchedBridge.registerLazyCallableModule` for all JS modules except for `HMRClient`, which uses `registerCallableModule` instead (takes the module itself instead of a function that returns it). I'm standardizing on `registerLazyCallableModule` so that it will be easier to swap out the implementation later for bridgeless mode.

The only reason I could think why we wouldn't want to do this is if we're relying on some side effect of `require('HMRClient')` when setting up JS, but there don't seem to be any side effects in that module that I can see.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18798870

fbshipit-source-id: a5c950bdbfd998bb12e4843ee28ece08a26c84bf
This commit is contained in:
Emily Janzer 2019-12-04 10:44:54 -08:00 коммит произвёл Facebook Github Bot
Родитель 37d8440a8e
Коммит de6aa10bdd
1 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -50,13 +50,11 @@ if (!global.RN$Bridgeless) {
); );
if (__DEV__ && !global.__RCTProfileIsProfiling) { if (__DEV__ && !global.__RCTProfileIsProfiling) {
BatchedBridge.registerCallableModule( BatchedBridge.registerLazyCallableModule('HMRClient', () =>
'HMRClient',
require('../Utilities/HMRClient'), require('../Utilities/HMRClient'),
); );
} else { } else {
BatchedBridge.registerCallableModule( BatchedBridge.registerLazyCallableModule('HMRClient', () =>
'HMRClient',
require('../Utilities/HMRClientProdShim'), require('../Utilities/HMRClientProdShim'),
); );
} }