UNPKG

21.7 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/fire'), require('rxjs'), require('rxjs/operators'), require('@angular/core'), require('@angular/fire/app'), require('firebase/app'), require('@angular/common'), require('rxfire/performance'), require('firebase/performance')) :
3 typeof define === 'function' && define.amd ? define('@angular/fire/performance', ['exports', '@angular/fire', 'rxjs', 'rxjs/operators', '@angular/core', '@angular/fire/app', 'firebase/app', '@angular/common', 'rxfire/performance', 'firebase/performance'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.angular = global.angular || {}, global.angular.fire = global.angular.fire || {}, global.angular.fire.performance = {}), global.angular.fire, global.rxjs, global.rxjs.operators, global.ng.core, global.angular.fire.app, global.app$1, global.ng.common, global['rxfire-performance'], global['firebase-performance']));
5}(this, (function (exports, fire, rxjs, operators, i0, app, app$1, common, performance$1, performance) { 'use strict';
6
7 function _interopNamespace(e) {
8 if (e && e.__esModule) return e;
9 var n = Object.create(null);
10 if (e) {
11 Object.keys(e).forEach(function (k) {
12 if (k !== 'default') {
13 var d = Object.getOwnPropertyDescriptor(e, k);
14 Object.defineProperty(n, k, d.get ? d : {
15 enumerable: true,
16 get: function () {
17 return e[k];
18 }
19 });
20 }
21 });
22 }
23 n['default'] = e;
24 return Object.freeze(n);
25 }
26
27 var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
29 var Performance = /** @class */ (function () {
30 function Performance(performance) {
31 return performance;
32 }
33 return Performance;
34 }());
35 var PERFORMANCE_PROVIDER_NAME = 'performance';
36 var PerformanceInstances = /** @class */ (function () {
37 function PerformanceInstances() {
38 return fire.ɵgetAllInstancesOf(PERFORMANCE_PROVIDER_NAME);
39 }
40 return PerformanceInstances;
41 }());
42 var performanceInstance$ = rxjs.timer(0, 300).pipe(operators.concatMap(function () { return rxjs.from(fire.ɵgetAllInstancesOf(PERFORMANCE_PROVIDER_NAME)); }), operators.distinct());
43
44 /*! *****************************************************************************
45 Copyright (c) Microsoft Corporation.
46
47 Permission to use, copy, modify, and/or distribute this software for any
48 purpose with or without fee is hereby granted.
49
50 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
51 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
52 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
53 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
54 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
55 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
56 PERFORMANCE OF THIS SOFTWARE.
57 ***************************************************************************** */
58 /* global Reflect, Promise */
59 var extendStatics = function (d, b) {
60 extendStatics = Object.setPrototypeOf ||
61 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
62 function (d, b) { for (var p in b)
63 if (Object.prototype.hasOwnProperty.call(b, p))
64 d[p] = b[p]; };
65 return extendStatics(d, b);
66 };
67 function __extends(d, b) {
68 if (typeof b !== "function" && b !== null)
69 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
70 extendStatics(d, b);
71 function __() { this.constructor = d; }
72 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
73 }
74 var __assign = function () {
75 __assign = Object.assign || function __assign(t) {
76 for (var s, i = 1, n = arguments.length; i < n; i++) {
77 s = arguments[i];
78 for (var p in s)
79 if (Object.prototype.hasOwnProperty.call(s, p))
80 t[p] = s[p];
81 }
82 return t;
83 };
84 return __assign.apply(this, arguments);
85 };
86 function __rest(s, e) {
87 var t = {};
88 for (var p in s)
89 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
90 t[p] = s[p];
91 if (s != null && typeof Object.getOwnPropertySymbols === "function")
92 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
93 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
94 t[p[i]] = s[p[i]];
95 }
96 return t;
97 }
98 function __decorate(decorators, target, key, desc) {
99 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
100 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
101 r = Reflect.decorate(decorators, target, key, desc);
102 else
103 for (var i = decorators.length - 1; i >= 0; i--)
104 if (d = decorators[i])
105 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
106 return c > 3 && r && Object.defineProperty(target, key, r), r;
107 }
108 function __param(paramIndex, decorator) {
109 return function (target, key) { decorator(target, key, paramIndex); };
110 }
111 function __metadata(metadataKey, metadataValue) {
112 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
113 return Reflect.metadata(metadataKey, metadataValue);
114 }
115 function __awaiter(thisArg, _arguments, P, generator) {
116 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
117 return new (P || (P = Promise))(function (resolve, reject) {
118 function fulfilled(value) { try {
119 step(generator.next(value));
120 }
121 catch (e) {
122 reject(e);
123 } }
124 function rejected(value) { try {
125 step(generator["throw"](value));
126 }
127 catch (e) {
128 reject(e);
129 } }
130 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
131 step((generator = generator.apply(thisArg, _arguments || [])).next());
132 });
133 }
134 function __generator(thisArg, body) {
135 var _ = { label: 0, sent: function () { if (t[0] & 1)
136 throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
137 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
138 function verb(n) { return function (v) { return step([n, v]); }; }
139 function step(op) {
140 if (f)
141 throw new TypeError("Generator is already executing.");
142 while (_)
143 try {
144 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
145 return t;
146 if (y = 0, t)
147 op = [op[0] & 2, t.value];
148 switch (op[0]) {
149 case 0:
150 case 1:
151 t = op;
152 break;
153 case 4:
154 _.label++;
155 return { value: op[1], done: false };
156 case 5:
157 _.label++;
158 y = op[1];
159 op = [0];
160 continue;
161 case 7:
162 op = _.ops.pop();
163 _.trys.pop();
164 continue;
165 default:
166 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
167 _ = 0;
168 continue;
169 }
170 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
171 _.label = op[1];
172 break;
173 }
174 if (op[0] === 6 && _.label < t[1]) {
175 _.label = t[1];
176 t = op;
177 break;
178 }
179 if (t && _.label < t[2]) {
180 _.label = t[2];
181 _.ops.push(op);
182 break;
183 }
184 if (t[2])
185 _.ops.pop();
186 _.trys.pop();
187 continue;
188 }
189 op = body.call(thisArg, _);
190 }
191 catch (e) {
192 op = [6, e];
193 y = 0;
194 }
195 finally {
196 f = t = 0;
197 }
198 if (op[0] & 5)
199 throw op[1];
200 return { value: op[0] ? op[1] : void 0, done: true };
201 }
202 }
203 var __createBinding = Object.create ? (function (o, m, k, k2) {
204 if (k2 === undefined)
205 k2 = k;
206 Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
207 }) : (function (o, m, k, k2) {
208 if (k2 === undefined)
209 k2 = k;
210 o[k2] = m[k];
211 });
212 function __exportStar(m, o) {
213 for (var p in m)
214 if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
215 __createBinding(o, m, p);
216 }
217 function __values(o) {
218 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
219 if (m)
220 return m.call(o);
221 if (o && typeof o.length === "number")
222 return {
223 next: function () {
224 if (o && i >= o.length)
225 o = void 0;
226 return { value: o && o[i++], done: !o };
227 }
228 };
229 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
230 }
231 function __read(o, n) {
232 var m = typeof Symbol === "function" && o[Symbol.iterator];
233 if (!m)
234 return o;
235 var i = m.call(o), r, ar = [], e;
236 try {
237 while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
238 ar.push(r.value);
239 }
240 catch (error) {
241 e = { error: error };
242 }
243 finally {
244 try {
245 if (r && !r.done && (m = i["return"]))
246 m.call(i);
247 }
248 finally {
249 if (e)
250 throw e.error;
251 }
252 }
253 return ar;
254 }
255 /** @deprecated */
256 function __spread() {
257 for (var ar = [], i = 0; i < arguments.length; i++)
258 ar = ar.concat(__read(arguments[i]));
259 return ar;
260 }
261 /** @deprecated */
262 function __spreadArrays() {
263 for (var s = 0, i = 0, il = arguments.length; i < il; i++)
264 s += arguments[i].length;
265 for (var r = Array(s), k = 0, i = 0; i < il; i++)
266 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
267 r[k] = a[j];
268 return r;
269 }
270 function __spreadArray(to, from) {
271 for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
272 to[j] = from[i];
273 return to;
274 }
275 function __await(v) {
276 return this instanceof __await ? (this.v = v, this) : new __await(v);
277 }
278 function __asyncGenerator(thisArg, _arguments, generator) {
279 if (!Symbol.asyncIterator)
280 throw new TypeError("Symbol.asyncIterator is not defined.");
281 var g = generator.apply(thisArg, _arguments || []), i, q = [];
282 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
283 function verb(n) { if (g[n])
284 i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
285 function resume(n, v) { try {
286 step(g[n](v));
287 }
288 catch (e) {
289 settle(q[0][3], e);
290 } }
291 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
292 function fulfill(value) { resume("next", value); }
293 function reject(value) { resume("throw", value); }
294 function settle(f, v) { if (f(v), q.shift(), q.length)
295 resume(q[0][0], q[0][1]); }
296 }
297 function __asyncDelegator(o) {
298 var i, p;
299 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
300 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
301 }
302 function __asyncValues(o) {
303 if (!Symbol.asyncIterator)
304 throw new TypeError("Symbol.asyncIterator is not defined.");
305 var m = o[Symbol.asyncIterator], i;
306 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
307 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
308 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
309 }
310 function __makeTemplateObject(cooked, raw) {
311 if (Object.defineProperty) {
312 Object.defineProperty(cooked, "raw", { value: raw });
313 }
314 else {
315 cooked.raw = raw;
316 }
317 return cooked;
318 }
319 ;
320 var __setModuleDefault = Object.create ? (function (o, v) {
321 Object.defineProperty(o, "default", { enumerable: true, value: v });
322 }) : function (o, v) {
323 o["default"] = v;
324 };
325 function __importStar(mod) {
326 if (mod && mod.__esModule)
327 return mod;
328 var result = {};
329 if (mod != null)
330 for (var k in mod)
331 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
332 __createBinding(result, mod, k);
333 __setModuleDefault(result, mod);
334 return result;
335 }
336 function __importDefault(mod) {
337 return (mod && mod.__esModule) ? mod : { default: mod };
338 }
339 function __classPrivateFieldGet(receiver, state, kind, f) {
340 if (kind === "a" && !f)
341 throw new TypeError("Private accessor was defined without a getter");
342 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
343 throw new TypeError("Cannot read private member from an object whose class did not declare it");
344 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
345 }
346 function __classPrivateFieldSet(receiver, state, value, kind, f) {
347 if (kind === "m")
348 throw new TypeError("Private method is not writable");
349 if (kind === "a" && !f)
350 throw new TypeError("Private accessor was defined without a setter");
351 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
352 throw new TypeError("Cannot write private member to an object whose class did not declare it");
353 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
354 }
355
356 var PROVIDED_PERFORMANCE_INSTANCES = new i0.InjectionToken('angularfire2.performance-instances');
357 function defaultPerformanceInstanceFactory(provided, defaultApp,
358 // tslint:disable-next-line:ban-types
359 platform) {
360 if (!common.isPlatformBrowser(platform)) {
361 return null;
362 }
363 var defaultPerformance = fire.ɵgetDefaultInstanceOf(PERFORMANCE_PROVIDER_NAME, provided, defaultApp);
364 return defaultPerformance && new Performance(defaultPerformance);
365 }
366 function performanceInstanceFactory(fn) {
367 // tslint:disable-next-line:ban-types
368 return function (zone, platform, injector) {
369 if (!common.isPlatformBrowser(platform)) {
370 return null;
371 }
372 var performance = zone.runOutsideAngular(function () { return fn(injector); });
373 return new Performance(performance);
374 };
375 }
376 var PERFORMANCE_INSTANCES_PROVIDER = {
377 provide: PerformanceInstances,
378 deps: [
379 [new i0.Optional(), PROVIDED_PERFORMANCE_INSTANCES],
380 ]
381 };
382 var DEFAULT_PERFORMANCE_INSTANCE_PROVIDER = {
383 provide: Performance,
384 useFactory: defaultPerformanceInstanceFactory,
385 deps: [
386 [new i0.Optional(), PROVIDED_PERFORMANCE_INSTANCES],
387 app.FirebaseApp,
388 i0.PLATFORM_ID,
389 ]
390 };
391 var PerformanceModule = /** @class */ (function () {
392 function PerformanceModule() {
393 app$1.registerVersion('angularfire', fire.VERSION.full, 'perf');
394 }
395 return PerformanceModule;
396 }());
397 PerformanceModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: PerformanceModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
398 PerformanceModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: PerformanceModule });
399 PerformanceModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: PerformanceModule, providers: [
400 DEFAULT_PERFORMANCE_INSTANCE_PROVIDER,
401 PERFORMANCE_INSTANCES_PROVIDER,
402 ] });
403 i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0__namespace, type: PerformanceModule, decorators: [{
404 type: i0.NgModule,
405 args: [{
406 providers: [
407 DEFAULT_PERFORMANCE_INSTANCE_PROVIDER,
408 PERFORMANCE_INSTANCES_PROVIDER,
409 ]
410 }]
411 }], ctorParameters: function () { return []; } });
412 function providePerformance(fn) {
413 var deps = [];
414 for (var _i = 1; _i < arguments.length; _i++) {
415 deps[_i - 1] = arguments[_i];
416 }
417 return {
418 ngModule: PerformanceModule,
419 providers: [{
420 provide: PROVIDED_PERFORMANCE_INSTANCES,
421 useFactory: performanceInstanceFactory(fn),
422 multi: true,
423 deps: __spreadArray([
424 i0.NgZone,
425 i0.PLATFORM_ID,
426 i0.Injector,
427 fire.ɵAngularFireSchedulers,
428 app.FirebaseApps
429 ], __read(deps))
430 }]
431 };
432 }
433
434 // DO NOT MODIFY, this file is autogenerated by tools/build.ts
435 var traceUntil = fire.ɵzoneWrap(performance$1.traceUntil, true);
436 var traceWhile = fire.ɵzoneWrap(performance$1.traceWhile, true);
437 var traceUntilComplete = fire.ɵzoneWrap(performance$1.traceUntilComplete, true);
438 var traceUntilFirst = fire.ɵzoneWrap(performance$1.traceUntilFirst, true);
439
440 // DO NOT MODIFY, this file is autogenerated by tools/build.ts
441 var getPerformance = fire.ɵzoneWrap(performance.getPerformance, true);
442 var initializePerformance = fire.ɵzoneWrap(performance.initializePerformance, true);
443 var trace = fire.ɵzoneWrap(performance.trace, true);
444
445 /**
446 * Generated bundle index. Do not edit.
447 */
448
449 exports.Performance = Performance;
450 exports.PerformanceInstances = PerformanceInstances;
451 exports.PerformanceModule = PerformanceModule;
452 exports.getPerformance = getPerformance;
453 exports.initializePerformance = initializePerformance;
454 exports.performanceInstance$ = performanceInstance$;
455 exports.providePerformance = providePerformance;
456 exports.trace = trace;
457 exports.traceUntil = traceUntil;
458 exports.traceUntilComplete = traceUntilComplete;
459 exports.traceUntilFirst = traceUntilFirst;
460 exports.traceWhile = traceWhile;
461 Object.keys(performance).forEach(function (k) {
462 if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
463 enumerable: true,
464 get: function () {
465 return performance[k];
466 }
467 });
468 });
469
470 Object.defineProperty(exports, '__esModule', { value: true });
471
472})));
473//# sourceMappingURL=angular-fire-performance.umd.js.map