mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-01 09:23:16 +08:00
Lazily instantiate native modules
Summary: Instead of sending a list of modules over to JS on startup (and actually blocking script execution) instead provide a proxy object that constructs each of these lazily. Reviewed By: lexs Differential Revision: D3936979 fbshipit-source-id: 71bde822f01eb17a29f56c5e60e95e98e207d74d
This commit is contained in:
committed by
Facebook Github Bot
parent
606fc11487
commit
9ed9bca0bf
@@ -42,12 +42,13 @@ ProxyExecutor::ProxyExecutor(jni::global_ref<jobject>&& executorInstance,
|
||||
, m_delegate(delegate) {
|
||||
|
||||
folly::dynamic nativeModuleConfig = folly::dynamic::array;
|
||||
auto moduleRegistry = delegate->getModuleRegistry();
|
||||
|
||||
{
|
||||
SystraceSection s("collectNativeModuleDescriptions");
|
||||
auto moduleRegistry = delegate->getModuleRegistry();
|
||||
for (const auto& name : moduleRegistry->moduleNames()) {
|
||||
nativeModuleConfig.push_back(moduleRegistry->getConfig(name));
|
||||
auto config = moduleRegistry->getConfig(name);
|
||||
nativeModuleConfig.push_back(config ? config->config : nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user