MCPcopy
hub / github.com/angular/angularfire / ɵfirebaseAppFactory

Function ɵfirebaseAppFactory

src/compat/firebase.app.module.ts:13–29  ·  view source on GitHub ↗
(options: FirebaseOptions, zone: NgZone, nameOrConfig?: string | FirebaseAppSettings | null)

Source from the content-addressed store, hash-verified

11
12
13export function ɵfirebaseAppFactory(options: FirebaseOptions, zone: NgZone, nameOrConfig?: string | FirebaseAppSettings | null) {
14 const name = typeof nameOrConfig === 'string' && nameOrConfig || '[DEFAULT]';
15 const config = typeof nameOrConfig === 'object' && nameOrConfig || {};
16 config.name = config.name || name;
17 // Added any due to some inconsistency between @firebase/app and firebase types
18 const existingApp = firebase.apps.filter(app => app && app.name === config.name)[0];
19 // We support FirebaseConfig, initializeApp's public type only accepts string; need to cast as any
20 // Could be solved with https://github.com/firebase/firebase-js-sdk/pull/1206
21 const app = (existingApp || zone.runOutsideAngular(() => firebase.initializeApp(options, config as any)));
22 try {
23 if (JSON.stringify(options) !== JSON.stringify(app.options)) {
24 const hmr = !!(module as any).hot;
25 log('error', `${app.name} Firebase App already initialized with different options${hmr ? ', you may need to reload as Firebase is not HMR aware.' : '.'}`);
26 }
27 } catch (e) { /* empty */ }
28 return new FirebaseApp(app);
29}
30
31const log = (level: 'log'|'error'|'info'|'warn', ...args: any) => {
32 if (isDevMode() && typeof console !== 'undefined') {

Callers 7

constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
constructorMethod · 0.90

Calls 2

initializeAppMethod · 0.80
logFunction · 0.70

Tested by

no test coverage detected