Java 类com.facebook.react.devsupport.DevServerHelper 实例源码

项目:ReactNativeSignatureExample    文件:ReactInstanceManagerImpl.java   
private void recreateReactContextInBackgroundInner() {
  UiThreadUtil.assertOnUiThread();

  if (mUseDeveloperSupport && mJSMainModuleName != null) {
    if (mDevSupportManager.hasUpToDateJSBundleInCache()) {
      // If there is a up-to-date bundle downloaded from server, always use that
      onJSBundleLoadedFromServer();
    } else if (mJSBundleFile == null) {
      mDevSupportManager.handleReloadJS();
    } else {
      mDevSupportManager.isPackagerRunning(
          new DevServerHelper.PackagerStatusCallback() {
            @Override
            public void onPackagerStatusFetched(final boolean packagerIsRunning) {
              UiThreadUtil.runOnUiThread(
                  new Runnable() {
                    @Override
                    public void run() {
                      if (packagerIsRunning) {
                        mDevSupportManager.handleReloadJS();
                      } else {
                        recreateReactContextInBackgroundFromBundleFile();
                      }
                    }
                  });
            }
          });
    }
    return;
  }

  recreateReactContextInBackgroundFromBundleFile();
}
项目:react-native-ibeacon-android    文件:ReactInstanceManagerImpl.java   
private void recreateReactContextInBackgroundInner() {
  UiThreadUtil.assertOnUiThread();

  if (mUseDeveloperSupport && mJSMainModuleName != null) {
    if (mDevSupportManager.hasUpToDateJSBundleInCache()) {
      // If there is a up-to-date bundle downloaded from server, always use that
      onJSBundleLoadedFromServer();
    } else if (mJSBundleFile == null) {
      mDevSupportManager.handleReloadJS();
    } else {
      mDevSupportManager.isPackagerRunning(
          new DevServerHelper.PackagerStatusCallback() {
            @Override
            public void onPackagerStatusFetched(final boolean packagerIsRunning) {
              UiThreadUtil.runOnUiThread(
                  new Runnable() {
                    @Override
                    public void run() {
                      if (packagerIsRunning) {
                        mDevSupportManager.handleReloadJS();
                      } else {
                        recreateReactContextInBackgroundFromBundleFile();
                      }
                    }
                  });
            }
          });
    }
    return;
  }

  recreateReactContextInBackgroundFromBundleFile();
}
项目:react-native-box-loaders    文件:ReactInstanceManagerImpl.java   
private void recreateReactContextInBackgroundInner() {
  UiThreadUtil.assertOnUiThread();

  if (mUseDeveloperSupport && mJSMainModuleName != null) {
    if (mDevSupportManager.hasUpToDateJSBundleInCache()) {
      // If there is a up-to-date bundle downloaded from server, always use that
      onJSBundleLoadedFromServer();
    } else if (mJSBundleFile == null) {
      mDevSupportManager.handleReloadJS();
    } else {
      mDevSupportManager.isPackagerRunning(
          new DevServerHelper.PackagerStatusCallback() {
            @Override
            public void onPackagerStatusFetched(final boolean packagerIsRunning) {
              UiThreadUtil.runOnUiThread(
                  new Runnable() {
                    @Override
                    public void run() {
                      if (packagerIsRunning) {
                        mDevSupportManager.handleReloadJS();
                      } else {
                        recreateReactContextInBackgroundFromBundleFile();
                      }
                    }
                  });
            }
          });
    }
    return;
  }

  recreateReactContextInBackgroundFromBundleFile();
}
项目:Ironman    文件:XReactInstanceManagerImpl.java   
private void recreateReactContextInBackgroundInner() {
  UiThreadUtil.assertOnUiThread();

  if (mUseDeveloperSupport && mJSMainModuleName != null) {
    final DeveloperSettings devSettings = mDevSupportManager.getDevSettings();

    // If remote JS debugging is enabled, load from dev server.
    if (mDevSupportManager.hasUpToDateJSBundleInCache() &&
        !devSettings.isRemoteJSDebugEnabled()) {
      // If there is a up-to-date bundle downloaded from server,
      // with remote JS debugging disabled, always use that.
      onJSBundleLoadedFromServer();
    } else if (mBundleLoader == null) {
      mDevSupportManager.handleReloadJS();
    } else {
      mDevSupportManager.isPackagerRunning(
          new DevServerHelper.PackagerStatusCallback() {
            @Override
            public void onPackagerStatusFetched(final boolean packagerIsRunning) {
              UiThreadUtil.runOnUiThread(
                  new Runnable() {
                    @Override
                    public void run() {
                      if (packagerIsRunning) {
                        mDevSupportManager.handleReloadJS();
                      } else {
                        // If dev server is down, disable the remote JS debugging.
                        devSettings.setRemoteJSDebugEnabled(false);
                        recreateReactContextInBackgroundFromBundleLoader();
                      }
                    }
                  });
            }
          });
    }
    return;
  }

  recreateReactContextInBackgroundFromBundleLoader();
}