react-native-macos/Libraries/Core
Emily Janzer 37ff892e24 Backwards-compatible implementation for registerCallableModule
Summary:
We currently use `BatchedBridge.registerCallableModule` to call JS from platform code in a bunch of places (e.g. `RCTDeviceEventEmitter.emit()`), including some pretty essential ones - for example, Networking relies on `RCTDeviceEventEmitter` to emit events to JS for network requests and errors. In order to make the migration to bridgeless mode as easy as possible, it'd be best if we didn't have to update all the callsites in JS and platform code, at least for core JS modules like `RCTDeviceEventEmitter`. So we'd like to implement this callable module pattern for bridgeless mode as well.

In this diff, I'm installing a global variable, `RN$registerCallableModule`, which will store the JS module name and factory function in C++. This can then be called from platform code (Java/Obj-C) to invoke a JS function on a module using the existing APIs (`context.getJSModule()` on Android, `enqueueJSCall()` or similar on iOS).

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D18798852

fbshipit-source-id: fbe9eaecaf6f5cab5173beec999d3a933b13375d
2019-12-17 18:38:57 -08:00
..
Devtools Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
SegmentFetcher TM JS: Revert to import from TurboModuleRegistry.js 2019-11-08 11:44:16 -08:00
Timers Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
__mocks__ Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
__tests__ Add codeFrame to each warning and error in LogBox 2019-11-08 08:31:01 -08:00
ExceptionsManager.js Add unstable_enableLogBox 2019-12-10 02:31:38 -08:00
InitializeCore.js Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
NativeExceptionsManager.js Exact-by-default codemod for react-native-github 2019-11-21 09:42:57 -08:00
ReactFiberErrorDialog.js Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
ReactNativeVersion.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
ReactNativeVersionCheck.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
checkNativeVersion.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
polyfillPromise.js Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
setUpAlert.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
setUpBatchedBridge.js Backwards-compatible implementation for registerCallableModule 2019-12-17 18:38:57 -08:00
setUpDeveloperTools.js Exact-by-default codemod for react-native-github 2019-11-21 09:42:57 -08:00
setUpErrorHandling.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
setUpGlobals.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
setUpNavigator.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
setUpReactDevTools.js Suppressions for 0.111 2019-11-05 17:36:23 -08:00
setUpReactRefresh.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
setUpRegeneratorRuntime.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
setUpSegmentFetcher.js Exact-by-default codemod for react-native-github 2019-11-21 09:42:57 -08:00
setUpSystrace.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
setUpTimers.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
setUpXHR.js Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00