How to use the @firebase/component.ComponentType.VERSION function in @firebase/component

To help you get started, we’ve selected a few @firebase/component 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 firebase / firebase-js-sdk / packages / app / src / firebaseApp.ts View on Github external
this.container = new ComponentContainer(config.name!);

    // add itself to container
    this._addComponent(new Component('app', () => this, ComponentType.PUBLIC));
    this._addComponent(
      new Component(
        'platform-logger',
        container => new PlatformLoggerService(container),
        ComponentType.PRIVATE
      )
    );
    this._addComponent(
      new Component(
        'app-version',
        () => new VersionService('app', version),
        ComponentType.VERSION
      )
    );
    this._addComponent(
      new Component(
        'platform-identifier',
        // Adds a string identifying version header as belonging to JS SDK
        () => new VersionService('fire-js', ''),
        ComponentType.VERSION
      )
    );
    // populate ComponentContainer with existing components
    for (const component of this.firebase_.INTERNAL.components.values()) {
      this._addComponent(component);
    }
  }
github firebase / firebase-js-sdk / packages / app / src / firebaseApp.ts View on Github external
ComponentType.PRIVATE
      )
    );
    this._addComponent(
      new Component(
        'app-version',
        () => new VersionService('app', version),
        ComponentType.VERSION
      )
    );
    this._addComponent(
      new Component(
        'platform-identifier',
        // Adds a string identifying version header as belonging to JS SDK
        () => new VersionService('fire-js', ''),
        ComponentType.VERSION
      )
    );
    // populate ComponentContainer with existing components
    for (const component of this.firebase_.INTERNAL.components.values()) {
      this._addComponent(component);
    }
  }
github firebase / firebase-js-sdk / packages / app / src / platformLoggerService.ts View on Github external
function isVersionServiceProvider(
  provider: Provider
): provider is Provider<'app-version'> {
  const component = provider.getComponent();
  return component?.type === ComponentType.VERSION;
}
github firebase / firebase-js-sdk / packages / app / src / firebaseNamespaceCore.ts View on Github external
if (libraryMismatch && versionMismatch) {
        warning.push('and');
      }
      if (versionMismatch) {
        warning.push(
          `version name "${version}" contains illegal characters (whitespace or "/")`
        );
      }
      logger.warn(warning.join(' '));
      return;
    }
    registerComponent(
      new Component(
        `${library}-version` as Name,
        () => ({ library, version }),
        ComponentType.VERSION
      )
    );
  }
github firebase / firebase-js-sdk / packages / app / src / next / index.ts View on Github external
if (libraryMismatch && versionMismatch) {
        warning.push('and');
      }
      if (versionMismatch) {
        warning.push(
          `version name "${version}" contains illegal characters (whitespace or "/")`
        );
      }
      logger.warn(warning.join(' '));
      return;
    }
    registerComponent(
      new Component(
        `${library}-version` as Name,
        () => ({ library, version }),
        ComponentType.VERSION
      )
    );
  }

@firebase/component

Firebase Component Platform

Apache-2.0
Latest version published 6 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages