How to use the metro/src/lib/bundle-modules/HMRClient.js function in metro

To help you get started, we’ve selected a few metro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rafeca / metro-sample-app / src / hmr.js View on Github external
function setup() {
  var client = new HmrClient(
    // TODO: make the URL/Entrypoint configurable
    `ws://localhost:8082/hot?bundleEntry=src/index.js`,
  );
  client.enable();

  client.on('update', function() {
    if (lastError) {
      clearOutdatedErrors();
      ErrorOverlay.dismissBuildError();
    }
    lastError = null;
  });
  client.on('error', function(error) {
    lastError = error;
    clearOutdatedErrors();
    ErrorOverlay.reportBuildError(error.message);