212 lines
13 KiB
JavaScript
212 lines
13 KiB
JavaScript
(function (global, factory) {
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/fire/compat'), require('@angular/common'), require('firebase/compat/app'), require('@angular/fire')) :
|
|
typeof define === 'function' && define.amd ? define('@angular/fire/compat/performance', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/fire/compat', '@angular/common', 'firebase/compat/app', '@angular/fire'], factory) :
|
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.angular = global.angular || {}, global.angular.fire = global.angular.fire || {}, global.angular.fire.compat = global.angular.fire.compat || {}, global.angular.fire.compat.performance = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.angular.fire.compat, global.ng.common, global.firebase, global.angular.fire));
|
|
}(this, (function (exports, i0, rxjs, operators, i1, common, firebase, fire) { 'use strict';
|
|
|
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
|
|
function _interopNamespace(e) {
|
|
if (e && e.__esModule) return e;
|
|
var n = Object.create(null);
|
|
if (e) {
|
|
Object.keys(e).forEach(function (k) {
|
|
if (k !== 'default') {
|
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
Object.defineProperty(n, k, d.get ? d : {
|
|
enumerable: true,
|
|
get: function () {
|
|
return e[k];
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
n['default'] = e;
|
|
return Object.freeze(n);
|
|
}
|
|
|
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
|
|
|
|
// DO NOT MODIFY, this file is autogenerated by tools/build.ts
|
|
// Export a null object with the same keys as firebase/compat/performance, so Proxy can work with proxy-polyfill in Internet Explorer
|
|
var proxyPolyfillCompat = {
|
|
app: null,
|
|
trace: null,
|
|
instrumentationEnabled: null,
|
|
dataCollectionEnabled: null,
|
|
};
|
|
|
|
var INSTRUMENTATION_ENABLED = new i0.InjectionToken('angularfire2.performance.instrumentationEnabled');
|
|
var DATA_COLLECTION_ENABLED = new i0.InjectionToken('angularfire2.performance.dataCollectionEnabled');
|
|
var AngularFirePerformance = /** @class */ (function () {
|
|
function AngularFirePerformance(app, instrumentationEnabled, dataCollectionEnabled, zone,
|
|
// tslint:disable-next-line:ban-types
|
|
platformId) {
|
|
this.zone = zone;
|
|
this.performance = rxjs.of(undefined).pipe(operators.switchMap(function () { return common.isPlatformBrowser(platformId) ? zone.runOutsideAngular(function () { return import('firebase/compat/performance'); }) : rxjs.EMPTY; }), operators.map(function () { return i1.ɵcacheInstance("performance", 'AngularFirePerformance', app.name, function () {
|
|
var performance = zone.runOutsideAngular(function () { return app.performance(); });
|
|
if (instrumentationEnabled === false) {
|
|
performance.instrumentationEnabled = false;
|
|
}
|
|
if (dataCollectionEnabled === false) {
|
|
performance.dataCollectionEnabled = false;
|
|
}
|
|
return performance;
|
|
}, [instrumentationEnabled, dataCollectionEnabled]); }), operators.shareReplay({ bufferSize: 1, refCount: false }));
|
|
return i1.ɵlazySDKProxy(this, this.performance, zone);
|
|
}
|
|
return AngularFirePerformance;
|
|
}());
|
|
AngularFirePerformance.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFirePerformance, deps: [{ token: i1__namespace.FirebaseApp }, { token: INSTRUMENTATION_ENABLED, optional: true }, { token: DATA_COLLECTION_ENABLED, optional: true }, { token: i0__namespace.NgZone }, { token: i0.PLATFORM_ID }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
AngularFirePerformance.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFirePerformance, providedIn: 'any' });
|
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFirePerformance, decorators: [{
|
|
type: i0.Injectable,
|
|
args: [{
|
|
providedIn: 'any'
|
|
}]
|
|
}], ctorParameters: function () {
|
|
return [{ type: i1__namespace.FirebaseApp }, { type: undefined, decorators: [{
|
|
type: i0.Optional
|
|
}, {
|
|
type: i0.Inject,
|
|
args: [INSTRUMENTATION_ENABLED]
|
|
}] }, { type: undefined, decorators: [{
|
|
type: i0.Optional
|
|
}, {
|
|
type: i0.Inject,
|
|
args: [DATA_COLLECTION_ENABLED]
|
|
}] }, { type: i0__namespace.NgZone }, { type: Object, decorators: [{
|
|
type: i0.Inject,
|
|
args: [i0.PLATFORM_ID]
|
|
}] }];
|
|
} });
|
|
var trace$ = function (traceId) {
|
|
var _a;
|
|
if (typeof window !== 'undefined' && ((_a = window.performance) === null || _a === void 0 ? void 0 : _a.mark)) {
|
|
var entries = window.performance.getEntriesByName(traceId, 'measure') || [];
|
|
var startMarkName_1 = "_" + traceId + "Start[" + entries.length + "]";
|
|
var endMarkName_1 = "_" + traceId + "End[" + entries.length + "]";
|
|
return new rxjs.Observable(function (emitter) {
|
|
window.performance.mark(startMarkName_1);
|
|
emitter.next();
|
|
return {
|
|
unsubscribe: function () {
|
|
window.performance.mark(endMarkName_1);
|
|
window.performance.measure(traceId, startMarkName_1, endMarkName_1);
|
|
}
|
|
};
|
|
});
|
|
}
|
|
else {
|
|
return rxjs.EMPTY;
|
|
}
|
|
};
|
|
var traceUntil = function (name, test, options) { return function (source$) { return new rxjs.Observable(function (subscriber) {
|
|
var traceSubscription = trace$(name).subscribe();
|
|
return source$.pipe(operators.tap(function (a) { return test(a) && traceSubscription.unsubscribe(); }, function () {
|
|
}, function () { return options && options.orComplete && traceSubscription.unsubscribe(); })).subscribe(subscriber);
|
|
}); }; };
|
|
var traceWhile = function (name, test, options) { return function (source$) { return new rxjs.Observable(function (subscriber) {
|
|
var traceSubscription;
|
|
return source$.pipe(operators.tap(function (a) {
|
|
if (test(a)) {
|
|
traceSubscription = traceSubscription || trace$(name).subscribe();
|
|
}
|
|
else {
|
|
if (traceSubscription) {
|
|
traceSubscription.unsubscribe();
|
|
}
|
|
traceSubscription = undefined;
|
|
}
|
|
}, function () {
|
|
}, function () { return options && options.orComplete && traceSubscription && traceSubscription.unsubscribe(); })).subscribe(subscriber);
|
|
}); }; };
|
|
var traceUntilComplete = function (name) { return function (source$) { return new rxjs.Observable(function (subscriber) {
|
|
var traceSubscription = trace$(name).subscribe();
|
|
return source$.pipe(operators.tap(function () {
|
|
}, function () {
|
|
}, function () { return traceSubscription.unsubscribe(); })).subscribe(subscriber);
|
|
}); }; };
|
|
var traceUntilFirst = function (name) { return function (source$) { return new rxjs.Observable(function (subscriber) {
|
|
var traceSubscription = trace$(name).subscribe();
|
|
return source$.pipe(operators.tap(function () { return traceSubscription.unsubscribe(); }, function () {
|
|
}, function () {
|
|
})).subscribe(subscriber);
|
|
}); }; };
|
|
var trace = function (name) { return function (source$) { return new rxjs.Observable(function (subscriber) {
|
|
var traceSubscription = trace$(name).subscribe();
|
|
return source$.pipe(operators.tap(function () { return traceSubscription.unsubscribe(); }, function () {
|
|
}, function () { return traceSubscription.unsubscribe(); })).subscribe(subscriber);
|
|
}); }; };
|
|
i1.ɵapplyMixins(AngularFirePerformance, [proxyPolyfillCompat]);
|
|
|
|
var IS_STABLE_START_MARK = 'Zone';
|
|
var IS_STABLE_END_MARK = '_isStableEnd';
|
|
var PerformanceMonitoringService = /** @class */ (function () {
|
|
function PerformanceMonitoringService(appRef) {
|
|
var _a;
|
|
if (typeof window !== 'undefined' && ((_a = window.performance) === null || _a === void 0 ? void 0 : _a.mark)) {
|
|
this.disposable = appRef.isStable.pipe(operators.first(function (it) { return it; }), operators.tap(function () {
|
|
window.performance.mark(IS_STABLE_END_MARK);
|
|
window.performance.measure('isStable', IS_STABLE_START_MARK, IS_STABLE_END_MARK);
|
|
})).subscribe();
|
|
}
|
|
}
|
|
PerformanceMonitoringService.prototype.ngOnDestroy = function () {
|
|
if (this.disposable) {
|
|
this.disposable.unsubscribe();
|
|
}
|
|
};
|
|
return PerformanceMonitoringService;
|
|
}());
|
|
PerformanceMonitoringService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: PerformanceMonitoringService, deps: [{ token: i0__namespace.ApplicationRef }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
PerformanceMonitoringService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: PerformanceMonitoringService });
|
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: PerformanceMonitoringService, decorators: [{
|
|
type: i0.Injectable
|
|
}], ctorParameters: function () { return [{ type: i0__namespace.ApplicationRef }]; } });
|
|
|
|
var AngularFirePerformanceModule = /** @class */ (function () {
|
|
function AngularFirePerformanceModule(perf, _) {
|
|
firebase__default['default'].registerVersion('angularfire', fire.VERSION.full, 'perf-compat');
|
|
// call anything here to get perf loading
|
|
// tslint:disable-next-line:no-unused-expression
|
|
perf.dataCollectionEnabled.then(function () { });
|
|
}
|
|
return AngularFirePerformanceModule;
|
|
}());
|
|
AngularFirePerformanceModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFirePerformanceModule, deps: [{ token: AngularFirePerformance }, { token: PerformanceMonitoringService, optional: true }], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
AngularFirePerformanceModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFirePerformanceModule });
|
|
AngularFirePerformanceModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFirePerformanceModule, providers: [AngularFirePerformance] });
|
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: AngularFirePerformanceModule, decorators: [{
|
|
type: i0.NgModule,
|
|
args: [{
|
|
providers: [AngularFirePerformance]
|
|
}]
|
|
}], ctorParameters: function () {
|
|
return [{ type: AngularFirePerformance }, { type: PerformanceMonitoringService, decorators: [{
|
|
type: i0.Optional
|
|
}] }];
|
|
} });
|
|
|
|
/**
|
|
* Generated bundle index. Do not edit.
|
|
*/
|
|
|
|
exports.AngularFirePerformance = AngularFirePerformance;
|
|
exports.AngularFirePerformanceModule = AngularFirePerformanceModule;
|
|
exports.DATA_COLLECTION_ENABLED = DATA_COLLECTION_ENABLED;
|
|
exports.INSTRUMENTATION_ENABLED = INSTRUMENTATION_ENABLED;
|
|
exports.PerformanceMonitoringService = PerformanceMonitoringService;
|
|
exports.trace = trace;
|
|
exports.traceUntil = traceUntil;
|
|
exports.traceUntilComplete = traceUntilComplete;
|
|
exports.traceUntilFirst = traceUntilFirst;
|
|
exports.traceWhile = traceWhile;
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
})));
|
|
//# sourceMappingURL=angular-fire-compat-performance.umd.js.map
|