Kargi-Sitesi/node_modules/@angular/fire/fesm2015/angular-fire-compat-performance.js.map

1 line
12 KiB
Text
Raw Normal View History

2024-11-04 02:30:09 +00:00
{"version":3,"file":"angular-fire-compat-performance.js","sources":["../../../src/compat/performance/base.ts","../../../src/compat/performance/performance.ts","../../../src/compat/performance/performance.service.ts","../../../src/compat/performance/performance.module.ts","../../../src/compat/performance/angular-fire-compat-performance.ts"],"sourcesContent":["// DO NOT MODIFY, this file is autogenerated by tools/build.ts\n// Export a null object with the same keys as firebase/compat/performance, so Proxy can work with proxy-polyfill in Internet Explorer\nexport const proxyPolyfillCompat = {\n app: null,\n trace: null,\n instrumentationEnabled: null,\n dataCollectionEnabled: null,\n};\n","import { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID } from '@angular/core';\nimport { EMPTY, Observable, of, Subscription } from 'rxjs';\nimport { map, shareReplay, switchMap, tap } from 'rxjs/operators';\nimport firebase from 'firebase/compat/app';\nimport { ɵapplyMixins, ɵlazySDKProxy, ɵPromiseProxy, ɵcacheInstance } from '@angular/fire/compat';\nimport { FirebaseApp } from '@angular/fire/compat';\nimport { isPlatformBrowser } from '@angular/common';\nimport { proxyPolyfillCompat } from './base';\n\nexport const INSTRUMENTATION_ENABLED = new InjectionToken<boolean>('angularfire2.performance.instrumentationEnabled');\nexport const DATA_COLLECTION_ENABLED = new InjectionToken<boolean>('angularfire2.performance.dataCollectionEnabled');\n\nexport interface AngularFirePerformance extends ɵPromiseProxy<firebase.performance.Performance> {\n}\n\n@Injectable({\n providedIn: 'any'\n})\nexport class AngularFirePerformance {\n\n private readonly performance: Observable<firebase.performance.Performance>;\n\n constructor(\n app: FirebaseApp,\n @Optional() @Inject(INSTRUMENTATION_ENABLED) instrumentationEnabled: boolean | null,\n @Optional() @Inject(DATA_COLLECTION_ENABLED) dataCollectionEnabled: boolean | null,\n private zone: NgZone,\n // tslint:disable-next-line:ban-types\n @Inject(PLATFORM_ID) platformId: Object\n ) {\n\n this.performance = of(undefined).pipe(\n switchMap(() => isPlatformBrowser(platformId) ? zone.runOutsideAngular(() => import('firebase/compat/performance')) : EMPTY),\n map(() => ɵcacheInstance(`performance`, 'AngularFirePerformance', app.name, () => {\n const performance = zone.runOutsideAngular(() => app.performance());\n if (instrumentationEnabled === false) {\n performance.instrumentationEnabled = false;\n }\n if (dataCollectionEnabled === false) {\n performance.dataCollectionEnabled = false;\n }\n return performance;\n }, [instrumentationEnabled, dataCollectionEnabled])),\n shareReplay({ bufferSize: 1, refCount: false })\n );\n\n return ɵlazySDKProxy(this, this.performance, zone);\n\n }\n\n}\n\nconst trace$ = (traceId: string) => {\n if (typeof window !== 'undefined' && window.performance?.mark) {\n const entries = window.performance.getEntriesByName(traceId, 'measure') || [];\n const startMarkName = `_${traceId}Start[${entries.length}]`;\n const endMarkName = `_${traceId}End[${entries.length}]`;\n return new Observable<void>(emitter => {\n window.performance.mark(startMarkName);\n emitter.next();\n return {\n unsubscribe: () => {\n window.performance.mark(endMarkName);\n window.performance.measure(traceId, startMarkName, endMarkName);\n }\n };\n });\n } else {\n return EMPTY;\n }\n};\n\nexport const traceUntil = <T = any>(\n name: string,\n test: (a: T) => boolean,\n options?: { orComplete?: boolean }\n) => (source$: Observable<T>) => new Observable<T>(subscriber => {\n const traceSubscription = trace$(name).subscribe();\n return source$.pipe(\n tap(\n a => test(a) && traceSubscription.unsubscribe(),\n () => {\n },\n () => options && options.orComplete && traceSubscription.unsubscribe()\n )\n ).subscribe(subscriber);\n});\n\nexport const traceWhile = <T = any>(\n name: string