Skip to content

Commit 8c8cb92

Browse files
committed
DI inject the default app, incase something is up
1 parent 634a94a commit 8c8cb92

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/performance/performance.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Injectable, NgZone, ApplicationRef, InjectionToken, Inject, Optional }
22
import { Observable, Subscription } from 'rxjs';
33
import { first, tap } from 'rxjs/operators';
44
import { performance } from 'firebase/app';
5+
import { FirebaseApp } from '@angular/fire';
56

67
export const AUTOMATICALLY_TRACE_CORE_NG_METRICS = new InjectionToken<boolean>('angularfire2.performance.auto_trace');
78
export const INSTRUMENTATION_ENABLED = new InjectionToken<boolean>('angularfire2.performance.instrumentationEnabled');
@@ -21,14 +22,15 @@ export class AngularFirePerformance {
2122
performance: performance.Performance;
2223

2324
constructor(
25+
app: FirebaseApp,
2426
@Optional() @Inject(AUTOMATICALLY_TRACE_CORE_NG_METRICS) automaticallyTraceCoreNgMetrics:boolean|null,
2527
@Optional() @Inject(INSTRUMENTATION_ENABLED) instrumentationEnabled:boolean|null,
2628
@Optional() @Inject(DATA_COLLECTION_ENABLED) dataCollectionEnabled:boolean|null,
2729
appRef: ApplicationRef,
2830
private zone: NgZone
2931
) {
3032

31-
this.performance = zone.runOutsideAngular(() => performance());
33+
this.performance = zone.runOutsideAngular(() => app.performance());
3234

3335
if (instrumentationEnabled == false) { this.performance.instrumentationEnabled = false }
3436
if (dataCollectionEnabled == false) { this.performance.dataCollectionEnabled = false }

0 commit comments

Comments
 (0)