1 line
No EOL
8.6 KiB
Text
1 line
No EOL
8.6 KiB
Text
{"version":3,"file":"index.cjs.js","sources":["../../performance/index.ts"],"sourcesContent":["import { EMPTY, from, Observable } from 'rxjs';\nimport { tap } from 'rxjs/operators';\n/**\n * Lazy loads Firebase Performance monitoring and returns the instance as\n * an observable\n * @param app\n * @returns Observable<FirebasePerformance>\n */\nexport var getPerformance$ = function (app) { return from(import('firebase/performance').then(function (module) { return module.getPerformance(app); })); };\n/**\n * Creates an observable that begins a trace with a given id. The trace is ended\n * when the observable unsubscribes. The measurement is also logged as a performance\n * entry.\n * @param traceId\n * @returns Observable<void>\n */\nvar trace$ = function (traceId) {\n if (typeof window !== 'undefined' && window.performance) {\n var entries = window.performance.getEntriesByName(traceId, 'measure') || [];\n var startMarkName_1 = \"_\".concat(traceId, \"Start[\").concat(entries.length, \"]\");\n var endMarkName_1 = \"_\".concat(traceId, \"End[\").concat(entries.length, \"]\");\n return new Observable(function (emitter) {\n window.performance.mark(startMarkName_1);\n emitter.next();\n return {\n unsubscribe: function () {\n window.performance.mark(endMarkName_1);\n window.performance.measure(traceId, startMarkName_1, endMarkName_1);\n },\n };\n });\n }\n else {\n return EMPTY;\n }\n};\n/**\n * Creates a function that creates an observable that begins a trace with a given id. The trace is ended\n * when the observable unsubscribes. The measurement is also logged as a performance\n * entry.\n * @param name\n * @returns (source$: Observable<T>) => Observable<T>\n */\nexport var trace = function (name) { return function (source$) { return new Observable(function (subscriber) {\n var traceSubscription = trace$(name).subscribe();\n return source$.pipe(tap(function () { return traceSubscription.unsubscribe(); }, function () {\n }, function () { return traceSubscription.unsubscribe(); })).subscribe(subscriber);\n}); }; };\n/**\n * Creates a function that creates an observable that begins a trace with a given name. The trace runs until\n * a condition resolves to true and then the observable unsubscribes and ends the trace.\n * @param name\n * @param test\n * @param options\n * @returns (source$: Observable<T>) => Observable<T>\n */\nexport var traceUntil = function (name, test, options) { return function (source$) { return new Observable(function (subscriber) {\n var traceSubscription = trace$(name).subscribe();\n return source$.pipe(tap(function (a) { return test(a) && traceSubscription.unsubscribe(); }, function () {\n }, function () { return options && options.orComplete && traceSubscription.unsubscribe(); })).subscribe(subscriber);\n}); }; };\n/**\n * Creates a function that creates an observable that begins a trace with a given name. The trace runs while\n * a condition resolves to true. Once the condition fails the observable unsubscribes\n * and ends the trace.\n * @param name\n * @param test\n * @param options\n * @returns (source$: Observable<T>) => Observable<T>\n */\nexport var traceWhile = function (name, test, options) { return function (source$) { return new Observable(function (subscriber) {\n var traceSubscription;\n return source$.pipe(tap(function (a) {\n if (test(a)) {\n traceSubscription = traceSubscription || trace$(name).subscribe();\n }\n else {\n if (traceSubscription) {\n traceSubscription.unsubscribe();\n }\n traceSubscription = undefined;\n }\n }, function () {\n }, function () { return options && options.orComplete && traceSubscription && traceSubscription.unsubscribe(); })).subscribe(subscriber);\n}); }; };\n/**\n * Creates a function that creates an observable that begins a trace with a given name. The trace runs until the\n * observable fully completes.\n * @param name\n * @returns (source$: Observable<T>) => Observable<T>\n */\nexport var traceUntilComplete = function (name) { return function (source$) { return new Observable(function (subscriber) {\n var traceSubscription = trace$(name).subscribe();\n return source$.pipe(tap(function () {\n }, function () {\n }, function () { return traceSubscription.unsubscribe(); })).subscribe(subscriber);\n}); }; };\n/**\n * Creates a function that creates an observable that begins a trace with a given name.\n * The trace runs until the first value emits from the provided observable.\n * @param name\n * @returns (source$: Observable<T>) => Observable<T>\n */\nexport var traceUntilFirst = function (name) { return function (source$) { return new Observable(function (subscriber) {\n var traceSubscription = trace$(name).subscribe();\n return source$.pipe(tap(function () { return traceSubscription.unsubscribe(); }, function () {\n }, function () {\n })).subscribe(subscriber);\n}); }; };\n"],"names":["from","Observable","EMPTY","tap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACU,IAAC,eAAe,GAAG,UAAU,GAAG,EAAE,EAAE,OAAOA,SAAI,CAAC,mFAAO,sBAAsB,MAAC,CAAC,IAAI,CAAC,UAAU,MA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