Java 类com.facebook.react.bridge.JavaScriptModuleRegistry 实例源码

项目:RNLearn_Project1    文件:ReactInstanceManager.java   
private void processPackage(
  ReactPackage reactPackage,
  NativeModuleRegistryBuilder nativeModuleRegistryBuilder,
  JavaScriptModuleRegistry.Builder jsModulesBuilder) {
  SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "processPackage")
    .arg("className", reactPackage.getClass().getSimpleName())
    .flush();
  if (reactPackage instanceof ReactPackageLogger) {
    ((ReactPackageLogger) reactPackage).startProcessPackage();
  }
  nativeModuleRegistryBuilder.processPackage(reactPackage);

  for (Class<? extends JavaScriptModule> jsModuleClass : reactPackage.createJSModules()) {
    jsModulesBuilder.add(jsModuleClass);
  }
  if (reactPackage instanceof ReactPackageLogger) {
    ((ReactPackageLogger) reactPackage).endProcessPackage();
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
private void processPackage(
  ReactPackage reactPackage,
  NativeModuleRegistryBuilder nativeModuleRegistryBuilder,
  JavaScriptModuleRegistry.Builder jsModulesBuilder) {
  SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "processPackage")
    .arg("className", reactPackage.getClass().getSimpleName())
    .flush();
  if (reactPackage instanceof ReactPackageLogger) {
    ((ReactPackageLogger) reactPackage).startProcessPackage();
  }
  nativeModuleRegistryBuilder.processPackage(reactPackage);

  for (Class<? extends JavaScriptModule> jsModuleClass : reactPackage.createJSModules()) {
    jsModulesBuilder.add(jsModuleClass);
  }
  if (reactPackage instanceof ReactPackageLogger) {
    ((ReactPackageLogger) reactPackage).endProcessPackage();
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
项目:RNLearn_Project1    文件:CatalystInstanceImpl.java   
private CatalystInstanceImpl(
    final ReactQueueConfigurationSpec ReactQueueConfigurationSpec,
    final JavaScriptExecutor jsExecutor,
    final NativeModuleRegistry registry,
    final JavaScriptModuleRegistry jsModuleRegistry,
    final JSBundleLoader jsBundleLoader,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
  FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge.");
  mHybridData = initHybrid();

  mReactQueueConfiguration = ReactQueueConfigurationImpl.create(
      ReactQueueConfigurationSpec,
      new NativeExceptionHandler());
  mBridgeIdleListeners = new CopyOnWriteArrayList<>();
  mJavaRegistry = registry;
  mJSModuleRegistry = jsModuleRegistry;
  mJSBundleLoader = jsBundleLoader;
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mNativeModulesQueueThread = mReactQueueConfiguration.getNativeModulesQueueThread();
  mTraceListener = new JSProfilerTraceListener(this);

  FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge");
  initializeBridge(
    new BridgeCallback(this),
    jsExecutor,
    mReactQueueConfiguration.getJSQueueThread(),
    mNativeModulesQueueThread,
    mJavaRegistry.getJavaModules(this),
    mJavaRegistry.getCxxModules());
  FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge");
  mMainExecutorToken = getMainExecutorToken();
}
项目:RNLearn_Project1    文件:CatalystInstanceImpl.java   
private CatalystInstanceImpl(
    final ReactQueueConfigurationSpec ReactQueueConfigurationSpec,
    final JavaScriptExecutor jsExecutor,
    final NativeModuleRegistry registry,
    final JavaScriptModuleRegistry jsModuleRegistry,
    final JSBundleLoader jsBundleLoader,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
  FLog.w(ReactConstants.TAG, "Initializing React Xplat Bridge.");
  mHybridData = initHybrid();

  mReactQueueConfiguration = ReactQueueConfigurationImpl.create(
      ReactQueueConfigurationSpec,
      new NativeExceptionHandler());
  mBridgeIdleListeners = new CopyOnWriteArrayList<>();
  mJavaRegistry = registry;
  mJSModuleRegistry = jsModuleRegistry;
  mJSBundleLoader = jsBundleLoader;
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mNativeModulesQueueThread = mReactQueueConfiguration.getNativeModulesQueueThread();
  mTraceListener = new JSProfilerTraceListener(this);

  FLog.w(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge");
  initializeBridge(
    new BridgeCallback(this),
    jsExecutor,
    mReactQueueConfiguration.getJSQueueThread(),
    mNativeModulesQueueThread,
    mJavaRegistry.getJavaModules(this),
    mJavaRegistry.getCxxModules());
  FLog.w(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge");
  mMainExecutorToken = getMainExecutorToken();
}
项目:react-native-workers    文件:ReactContextBuilder.java   
private void addJSModules(JavaScriptModuleRegistry.Builder jsModulesBuilder) {
    for (int i = 0; i < reactPackages.size(); i++) {
        ReactPackage reactPackage = reactPackages.get(i);
        for (Class<? extends JavaScriptModule> jsModuleClass : reactPackage.createJSModules()) {
            jsModulesBuilder.add(jsModuleClass);
        }
    }
}
项目:Ironman    文件:XReactInstanceManagerImpl.java   
private void processPackage(
  ReactPackage reactPackage,
  ReactApplicationContext reactContext,
  List<ModuleSpec> moduleSpecs,
  Map<Class, ReactModuleInfo> reactModuleInfoMap,
  JavaScriptModuleRegistry.Builder jsModulesBuilder) {
  SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "processPackage")
    .arg("className", reactPackage.getClass().getSimpleName())
    .flush();
  if (mLazyNativeModulesEnabled && reactPackage instanceof LazyReactPackage) {
    LazyReactPackage lazyReactPackage = (LazyReactPackage) reactPackage;
    ReactModuleInfoProvider instance = lazyReactPackage.getReactModuleInfoProvider();
    Map<Class, ReactModuleInfo> map = instance.getReactModuleInfos();
    if (!map.isEmpty()) {
      reactModuleInfoMap.putAll(map);
    }
    moduleSpecs.addAll(lazyReactPackage.getNativeModules(reactContext));
  } else {
    FLog.d(
      ReactConstants.TAG,
      reactPackage.getClass().getSimpleName() +
        " is not a LazyReactPackage, falling back to old version.");
    for (NativeModule nativeModule : reactPackage.createNativeModules(reactContext)) {
      moduleSpecs.add(
          new ModuleSpec(nativeModule.getClass(), new EagerModuleProvider(nativeModule)));
    }
  }

  for (Class<? extends JavaScriptModule> jsModuleClass : reactPackage.createJSModules()) {
    jsModulesBuilder.add(jsModuleClass);
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
项目:Ironman    文件:CatalystInstanceImpl.java   
private CatalystInstanceImpl(
    final ReactQueueConfigurationSpec ReactQueueConfigurationSpec,
    final JavaScriptExecutor jsExecutor,
    final NativeModuleRegistry registry,
    final JavaScriptModuleRegistry jsModuleRegistry,
    final JSBundleLoader jsBundleLoader,
    NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
  FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge.");
  mHybridData = initHybrid();

  mReactQueueConfiguration = ReactQueueConfigurationImpl.create(
      ReactQueueConfigurationSpec,
      new NativeExceptionHandler());
  mBridgeIdleListeners = new CopyOnWriteArrayList<>();
  mJavaRegistry = registry;
  mJSModuleRegistry = jsModuleRegistry;
  mJSBundleLoader = jsBundleLoader;
  mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
  mTraceListener = new JSProfilerTraceListener(this);

  initializeBridge(
    new BridgeCallback(this),
    jsExecutor,
    mReactQueueConfiguration.getJSQueueThread(),
    mReactQueueConfiguration.getNativeModulesQueueThread(),
    mJavaRegistry.getModuleRegistryHolder(this));
  mMainExecutorToken = getMainExecutorToken();
}
项目:RNLearn_Project1    文件:CatalystInstanceImpl.java   
public Builder setJSModuleRegistry(JavaScriptModuleRegistry jsModuleRegistry) {
  mJSModuleRegistry = jsModuleRegistry;
  return this;
}
项目:RNLearn_Project1    文件:CatalystInstanceImpl.java   
public Builder setJSModuleRegistry(JavaScriptModuleRegistry jsModuleRegistry) {
  mJSModuleRegistry = jsModuleRegistry;
  return this;
}
项目:Ironman    文件:CatalystInstanceImpl.java   
public Builder setJSModuleRegistry(JavaScriptModuleRegistry jsModuleRegistry) {
  mJSModuleRegistry = jsModuleRegistry;
  return this;
}