116 lines
4.8 KiB
JavaScript
116 lines
4.8 KiB
JavaScript
import { ɵgetAllInstancesOf, ɵgetDefaultInstanceOf, VERSION, ɵAngularFireSchedulers, ɵzoneWrap } from '@angular/fire';
|
|
import { timer, from } from 'rxjs';
|
|
import { concatMap, distinct } from 'rxjs/operators';
|
|
import * as i0 from '@angular/core';
|
|
import { InjectionToken, Optional, PLATFORM_ID, NgModule, NgZone, Injector } from '@angular/core';
|
|
import { FirebaseApp, FirebaseApps } from '@angular/fire/app';
|
|
import { registerVersion } from 'firebase/app';
|
|
import { isPlatformBrowser } from '@angular/common';
|
|
import { traceUntil as traceUntil$1, traceWhile as traceWhile$1, traceUntilComplete as traceUntilComplete$1, traceUntilFirst as traceUntilFirst$1 } from 'rxfire/performance';
|
|
import { getPerformance as getPerformance$1, initializePerformance as initializePerformance$1, trace as trace$1 } from 'firebase/performance';
|
|
export * from 'firebase/performance';
|
|
|
|
class Performance {
|
|
constructor(performance) {
|
|
return performance;
|
|
}
|
|
}
|
|
const PERFORMANCE_PROVIDER_NAME = 'performance';
|
|
class PerformanceInstances {
|
|
constructor() {
|
|
return ɵgetAllInstancesOf(PERFORMANCE_PROVIDER_NAME);
|
|
}
|
|
}
|
|
const performanceInstance$ = timer(0, 300).pipe(concatMap(() => from(ɵgetAllInstancesOf(PERFORMANCE_PROVIDER_NAME))), distinct());
|
|
|
|
const PROVIDED_PERFORMANCE_INSTANCES = new InjectionToken('angularfire2.performance-instances');
|
|
function defaultPerformanceInstanceFactory(provided, defaultApp,
|
|
// tslint:disable-next-line:ban-types
|
|
platform) {
|
|
if (!isPlatformBrowser(platform)) {
|
|
return null;
|
|
}
|
|
const defaultPerformance = ɵgetDefaultInstanceOf(PERFORMANCE_PROVIDER_NAME, provided, defaultApp);
|
|
return defaultPerformance && new Performance(defaultPerformance);
|
|
}
|
|
function performanceInstanceFactory(fn) {
|
|
// tslint:disable-next-line:ban-types
|
|
return (zone, platform, injector) => {
|
|
if (!isPlatformBrowser(platform)) {
|
|
return null;
|
|
}
|
|
const performance = zone.runOutsideAngular(() => fn(injector));
|
|
return new Performance(performance);
|
|
};
|
|
}
|
|
const PERFORMANCE_INSTANCES_PROVIDER = {
|
|
provide: PerformanceInstances,
|
|
deps: [
|
|
[new Optional(), PROVIDED_PERFORMANCE_INSTANCES],
|
|
]
|
|
};
|
|
const DEFAULT_PERFORMANCE_INSTANCE_PROVIDER = {
|
|
provide: Performance,
|
|
useFactory: defaultPerformanceInstanceFactory,
|
|
deps: [
|
|
[new Optional(), PROVIDED_PERFORMANCE_INSTANCES],
|
|
FirebaseApp,
|
|
PLATFORM_ID,
|
|
]
|
|
};
|
|
class PerformanceModule {
|
|
constructor() {
|
|
registerVersion('angularfire', VERSION.full, 'perf');
|
|
}
|
|
}
|
|
PerformanceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: PerformanceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
PerformanceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: PerformanceModule });
|
|
PerformanceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: PerformanceModule, providers: [
|
|
DEFAULT_PERFORMANCE_INSTANCE_PROVIDER,
|
|
PERFORMANCE_INSTANCES_PROVIDER,
|
|
] });
|
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: PerformanceModule, decorators: [{
|
|
type: NgModule,
|
|
args: [{
|
|
providers: [
|
|
DEFAULT_PERFORMANCE_INSTANCE_PROVIDER,
|
|
PERFORMANCE_INSTANCES_PROVIDER,
|
|
]
|
|
}]
|
|
}], ctorParameters: function () { return []; } });
|
|
function providePerformance(fn, ...deps) {
|
|
return {
|
|
ngModule: PerformanceModule,
|
|
providers: [{
|
|
provide: PROVIDED_PERFORMANCE_INSTANCES,
|
|
useFactory: performanceInstanceFactory(fn),
|
|
multi: true,
|
|
deps: [
|
|
NgZone,
|
|
PLATFORM_ID,
|
|
Injector,
|
|
ɵAngularFireSchedulers,
|
|
FirebaseApps,
|
|
...deps,
|
|
]
|
|
}]
|
|
};
|
|
}
|
|
|
|
// DO NOT MODIFY, this file is autogenerated by tools/build.ts
|
|
const traceUntil = ɵzoneWrap(traceUntil$1, true);
|
|
const traceWhile = ɵzoneWrap(traceWhile$1, true);
|
|
const traceUntilComplete = ɵzoneWrap(traceUntilComplete$1, true);
|
|
const traceUntilFirst = ɵzoneWrap(traceUntilFirst$1, true);
|
|
|
|
// DO NOT MODIFY, this file is autogenerated by tools/build.ts
|
|
const getPerformance = ɵzoneWrap(getPerformance$1, true);
|
|
const initializePerformance = ɵzoneWrap(initializePerformance$1, true);
|
|
const trace = ɵzoneWrap(trace$1, true);
|
|
|
|
/**
|
|
* Generated bundle index. Do not edit.
|
|
*/
|
|
|
|
export { Performance, PerformanceInstances, PerformanceModule, getPerformance, initializePerformance, performanceInstance$, providePerformance, trace, traceUntil, traceUntilComplete, traceUntilFirst, traceWhile };
|
|
//# sourceMappingURL=angular-fire-performance.js.map
|