How to use @firebase/component - 10 common examples

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 maierj / fastlane-action / node_modules / @firebase / installations / dist / index.esm2017.js View on Github external
function registerInstallations(instance) {
    const installationsName = 'installations';
    instance.INTERNAL.registerComponent(new Component(installationsName, container => {
        const app = container.getProvider('app').getImmediate();
        // Throws if app isn't configured properly.
        extractAppConfig(app);
        return {
            app,
            getId: () => getId(app),
            getToken: (forceRefresh) => getToken(app, forceRefresh),
            delete: () => deleteInstallation$1(app)
        };
    }, "PUBLIC" /* PUBLIC */));
}
registerInstallations(firebase);
github maierj / fastlane-action / node_modules / @firebase / installations / dist / index.esm.js View on Github external
function registerInstallations(instance) {
    var installationsName = 'installations';
    instance.INTERNAL.registerComponent(new Component(installationsName, function (container) {
        var app = container.getProvider('app').getImmediate();
        // Throws if app isn't configured properly.
        extractAppConfig(app);
        return {
            app: app,
            getId: function () { return getId(app); },
            getToken: function (forceRefresh) { return getToken(app, forceRefresh); },
            delete: function () { return deleteInstallation$1(app); }
        };
    }, "PUBLIC" /* PUBLIC */));
}
registerInstallations(firebase);
github maierj / fastlane-action / node_modules / @firebase / analytics / dist / index.esm.js View on Github external
function registerAnalytics(instance) {
    instance.INTERNAL.registerComponent(new Component(ANALYTICS_TYPE, function (container) {
        // getImmediate for FirebaseApp will always succeed
        var app = container.getProvider('app').getImmediate();
        var installations = container
            .getProvider('installations')
            .getImmediate();
        return factory(app, installations);
    }, "PUBLIC" /* PUBLIC */).setServiceProps({
        settings: settings,
        EventName: EventName
    }));
    instance.INTERNAL.registerComponent(new Component('analytics-internal', internalFactory, "PRIVATE" /* PRIVATE */));
    function internalFactory(container) {
        try {
            var analytics = container.getProvider(ANALYTICS_TYPE).getImmediate();
            return {
                logEvent: analytics.logEvent
            };
        }
        catch (e) {
            throw ERROR_FACTORY.create("interop-component-reg-failed" /* INTEROP_COMPONENT_REG_FAILED */, {
                reason: e
            });
        }
    }
}
registerAnalytics(firebase);
github maierj / fastlane-action / node_modules / @firebase / functions / dist / index.esm.js View on Github external
function registerFunctions(instance) {
    var namespaceExports = {
        // no-inline
        Functions: Service
    };
    instance.INTERNAL.registerComponent(new Component(FUNCTIONS_TYPE, factory, "PUBLIC" /* PUBLIC */)
        .setServiceProps(namespaceExports)
        .setMultipleInstances(true));
}
github firebase / firebase-js-sdk / packages / storage / index.ts View on Github external
export function registerStorage(instance: _FirebaseNamespace): void {
  const namespaceExports = {
    // no-inline
    TaskState,
    TaskEvent,
    StringFormat,
    Storage: Service,
    Reference
  };
  instance.INTERNAL.registerComponent(
    new Component(STORAGE_TYPE, factory, ComponentType.PUBLIC)
      .setServiceProps(namespaceExports)
      .setMultipleInstances(true)
  );

  instance.registerVersion(name, version);
}
github firebase / firebase-js-sdk / packages / remote-config / index.ts View on Github external
export function registerRemoteConfig(
  firebaseInstance: _FirebaseNamespace
): void {
  firebaseInstance.INTERNAL.registerComponent(
    new Component(
      'remoteConfig',
      remoteConfigFactory,
      ComponentType.PUBLIC
    ).setMultipleInstances(true)
  );

  firebaseInstance.registerVersion(packageName, version);

  function remoteConfigFactory(
    container: ComponentContainer,
    namespace?: string
  ): RemoteConfig {
    /* Dependencies */
    // getImmediate for FirebaseApp will always succeed
    const app = container.getProvider('app').getImmediate();
    // The following call will always succeed because rc has `import '@firebase/installations'`
github maierj / fastlane-action / node_modules / @firebase / storage / dist / index.esm.js View on Github external
function registerStorage(instance) {
    var namespaceExports = {
        // no-inline
        TaskState: TaskState,
        TaskEvent: TaskEvent,
        StringFormat: StringFormat,
        Storage: Service,
        Reference: Reference
    };
    instance.INTERNAL.registerComponent(new Component(STORAGE_TYPE, factory, "PUBLIC" /* PUBLIC */)
        .setServiceProps(namespaceExports)
        .setMultipleInstances(true));
}
registerStorage(firebase);
github maierj / fastlane-action / node_modules / @firebase / remote-config / dist / index.esm.js View on Github external
function registerRemoteConfig(firebaseInstance) {
    firebaseInstance.INTERNAL.registerComponent(new Component('remoteConfig', remoteConfigFactory, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
    function remoteConfigFactory(container, namespace) {
        /* Dependencies */
        // getImmediate for FirebaseApp will always succeed
        var app = container.getProvider('app').getImmediate();
        // The following call will always succeed because rc has `import '@firebase/installations'`
        var installations = container.getProvider('installations').getImmediate();
        // Guards against the SDK being used in non-browser environments.
        if (typeof window === 'undefined') {
            throw ERROR_FACTORY.create("registration-window" /* REGISTRATION_WINDOW */);
        }
        // Normalizes optional inputs.
        var _a = app.options, projectId = _a.projectId, apiKey = _a.apiKey, appId = _a.appId;
        if (!projectId) {
            throw ERROR_FACTORY.create("registration-project-id" /* REGISTRATION_PROJECT_ID */);
        }
        if (!apiKey) {
github firebase / firebase-js-sdk / packages / app / src / registerCoreComponents.ts View on Github external
export function registerCoreComponents(
  firebase: FirebaseNamespace,
  variant?: string
): void {
  (firebase as _FirebaseNamespace).INTERNAL.registerComponent(
    new Component(
      'platform-logger',
      container => new PlatformLoggerService(container),
      ComponentType.PRIVATE
    )
  );
  // Register `app` package.
  firebase.registerVersion(name, version, variant);
  // Register platform SDK identifier (no version).
  firebase.registerVersion('fire-js', '');
}
github maierj / fastlane-action / node_modules / @firebase / installations / dist / index.cjs.js View on Github external
function registerInstallations(instance) {
    var installationsName = 'installations';
    instance.INTERNAL.registerComponent(new component.Component(installationsName, function (container) {
        var app = container.getProvider('app').getImmediate();
        // Throws if app isn't configured properly.
        extractAppConfig(app);
        return {
            app: app,
            getId: function () { return getId(app); },
            getToken: function (forceRefresh) { return getToken(app, forceRefresh); },
            delete: function () { return deleteInstallation$1(app); }
        };
    }, "PUBLIC" /* PUBLIC */));
}
registerInstallations(firebase);

@firebase/component

Firebase Component Platform

Apache-2.0
Latest version published 14 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages