mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Support passing native modules to JSContext
Reviewed By: amnn Differential Revision: D4561036 fbshipit-source-id: b096a222103e895b14cba1ec5b2bb6e72dd72c37
This commit is contained in:
committed by
Facebook Github Bot
parent
bacee5ad56
commit
7e4b8ff000
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Instance.h"
|
||||
|
||||
#include "CxxMessageQueue.h"
|
||||
#include "Executor.h"
|
||||
#include "MethodCall.h"
|
||||
#include "RecoverableError.h"
|
||||
@@ -36,6 +37,15 @@ void Instance::initializeBridge(
|
||||
std::shared_ptr<ModuleRegistry> moduleRegistry) {
|
||||
callback_ = std::move(callback);
|
||||
|
||||
if (!nativeQueue) {
|
||||
// TODO pass down a thread/queue from java, instead of creating our own.
|
||||
|
||||
auto queue = std::make_unique<CxxMessageQueue>();
|
||||
std::thread t(queue->getUnregisteredRunLoop());
|
||||
t.detach();
|
||||
nativeQueue = std::move(queue);
|
||||
}
|
||||
|
||||
jsQueue->runOnQueueSync(
|
||||
[this, &jsef, moduleRegistry, jsQueue,
|
||||
nativeQueue=folly::makeMoveWrapper(std::move(nativeQueue))] () mutable {
|
||||
|
||||
Reference in New Issue
Block a user