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

项目:RNLearn_Project1    文件:CoreModulesPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  List<Class<? extends JavaScriptModule>> jsModules = new ArrayList<>(Arrays.asList(
      DeviceEventManagerModule.RCTDeviceEventEmitter.class,
      JSTimersExecution.class,
      RCTEventEmitter.class,
      RCTNativeAppEventEmitter.class,
      AppRegistry.class,
      com.facebook.react.bridge.Systrace.class,
      HMRClient.class));

  if (ReactBuildConfig.DEBUG) {
    jsModules.add(DebugComponentOwnershipModule.RCTDebugComponentOwnership.class);
    jsModules.add(JSCHeapCapture.HeapCapture.class);
    jsModules.add(JSCSamplingProfiler.SamplingProfiler.class);
  }

  return jsModules;
}
项目: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    文件:CompositeReactPackageTest.java   
@Test
public void testThatCompositeReturnsASumOfJSModules() {
  // Given
  CompositeReactPackage composite = new CompositeReactPackage(packageNo1, packageNo2);

  Class<? extends JavaScriptModule> moduleNo1 = mock(JavaScriptModuleNo1.class).getClass();
  Class<? extends JavaScriptModule> moduleNo2 = mock(JavaScriptModuleNo2.class).getClass();
  Class<? extends JavaScriptModule> moduleNo3 = mock(JavaScriptModuleNo3.class).getClass();

  List<Class<? extends JavaScriptModule>> l1 = new ArrayList<>();
  l1.add(moduleNo1);
  when(packageNo1.createJSModules()).thenReturn(l1);

  List<Class<? extends JavaScriptModule>> l2 = new ArrayList<>();
  l2.add(moduleNo2);
  l2.add(moduleNo3);
  when(packageNo2.createJSModules()).thenReturn(l2);

  // When
  List<Class<? extends JavaScriptModule>> compositeModules = composite.createJSModules();

  // Then

  // wrapping lists into sets to be order-independent
  List<Class<? extends JavaScriptModule>> l3 = new ArrayList<>();
  l3.add(moduleNo1);
  l3.add(moduleNo2);
  l3.add(moduleNo3);
  Set<Class<? extends JavaScriptModule>> expected = new HashSet<>(l3);
  Set<Class<? extends JavaScriptModule>> actual = new HashSet<>(compositeModules);

  assertEquals(expected, actual);
}
项目:RNLearn_Project1    文件:CompositeReactPackage.java   
/**
 * {@inheritDoc}
 */
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  final Set<Class<? extends JavaScriptModule>> moduleSet = new HashSet<>();
  for (ReactPackage reactPackage: mChildReactPackages) {
    for (Class<? extends JavaScriptModule> jsModule: reactPackage.createJSModules()) {
      moduleSet.add(jsModule);
    }
  }
  return new ArrayList(moduleSet);
}
项目:RNLearn_Project1    文件:CompositeReactPackageTest.java   
@Test
public void testThatCompositeReturnsASumOfJSModules() {
  // Given
  CompositeReactPackage composite = new CompositeReactPackage(packageNo1, packageNo2);

  Class<? extends JavaScriptModule> moduleNo1 = mock(JavaScriptModuleNo1.class).getClass();
  Class<? extends JavaScriptModule> moduleNo2 = mock(JavaScriptModuleNo2.class).getClass();
  Class<? extends JavaScriptModule> moduleNo3 = mock(JavaScriptModuleNo3.class).getClass();

  List<Class<? extends JavaScriptModule>> l1 = new ArrayList<>();
  l1.add(moduleNo1);
  when(packageNo1.createJSModules()).thenReturn(l1);

  List<Class<? extends JavaScriptModule>> l2 = new ArrayList<>();
  l2.add(moduleNo2);
  l2.add(moduleNo3);
  when(packageNo2.createJSModules()).thenReturn(l2);

  // When
  List<Class<? extends JavaScriptModule>> compositeModules = composite.createJSModules();

  // Then

  // wrapping lists into sets to be order-independent
  List<Class<? extends JavaScriptModule>> l3 = new ArrayList<>();
  l3.add(moduleNo1);
  l3.add(moduleNo2);
  l3.add(moduleNo3);
  Set<Class<? extends JavaScriptModule>> expected = new HashSet<>(l3);
  Set<Class<? extends JavaScriptModule>> actual = new HashSet<>(compositeModules);

  assertEquals(expected, actual);
}
项目:react-native-taptargetview    文件:RNTapTargetViewPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-videoplayer    文件:ReactVideoPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-image-intent    文件:ImageIntentPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:RNLearn_Project1    文件:MainReactPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-webrtc    文件:WebRTCModulePackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-pgp    文件:Package.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:RNLearn_Project1    文件:InstanceSpecForTestPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return mSpecForTest.getExtraJSModulesForTest();
}
项目:react-native-alarm-notification    文件:ANPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-dominant-color    文件:RNDominantColorPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-mail-compose    文件:RNMailComposePackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-download-manager    文件:DownloadFilePackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-camera-android-simple    文件:CameraPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:RNLearn_Project1    文件:ReactPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-mssql    文件:MSSQLPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-cloudinary    文件:RNCloudinaryPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-system-setting    文件:SystemSettingPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-message-compose    文件:RNMessageComposePackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-double-date-picker    文件:DoubleDatePickerPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-andorid-shadow    文件:RNReactNativeAndoridShadowPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-android-drawables    文件:DrawablesPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules()
{
    return Collections.emptyList();
}
项目:react-native-connectivity-status    文件:RNConnectivityStatusPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-background-task    文件:BackgroundTaskPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-android-circular-reveal    文件:ReactAndroidCircularRevealPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-sketch-view    文件:RNSketchViewPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-android-speech-recognizer    文件:RNAndroidSpeechRecognizerPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-udesk    文件:UdeskPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-android-library-humaniq-api    文件:Package.java   
@Override public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:RNLearn_Project1    文件:CatalystInstanceImpl.java   
@Override
public <T extends JavaScriptModule> T getJSModule(ExecutorToken executorToken, Class<T> jsInterface) {
  return Assertions.assertNotNull(mJSModuleRegistry)
      .getJavaScriptModule(this, executorToken, jsInterface);
}
项目:react-native-hour-format    文件:RNHourFormatPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
项目:react-native-blue-manager    文件:BleManagerPackage.java   
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return new ArrayList<>();
}
项目:react-native-get-sms-android    文件:SmsPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-openxc    文件:RNOpenXCPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:react-native-pili-player    文件:PiliPackage.java   
public List<Class<? extends JavaScriptModule>> createJSModules() {
    return Collections.emptyList();
}
项目:RNLearn_Project1    文件:CatalystInstanceImpl.java   
@Override
public <T extends JavaScriptModule> T getJSModule(ExecutorToken executorToken, Class<T> jsInterface) {
  return Assertions.assertNotNull(mJSModuleRegistry)
      .getJavaScriptModule(this, executorToken, jsInterface);
}