8000 fix(perf): AFP should not error in Jest #2813 (#2920) · angular/angularfire@b0e147e · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit b0e147e

Browse files
authored
fix(perf): AFP should not error in Jest #2813 (#2920)
1 parent 6a652df commit b0e147e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/compat/performance/performance.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const IS_STABLE_START_MARK = '_isStableStart';
66
const IS_STABLE_END_MARK = '_isStableEnd';
77

88
function markStarts() {
9-
if (typeof(window) !== 'undefined' && window.performance) {
9+
if (typeof(window) !== 'undefined' && window.performance && window.performance.mark) {
1010
window.performance.mark(IS_STABLE_START_MARK);
1111
return true;
1212
} else {
@@ -22,7 +22,7 @@ export class PerformanceMonitoringService implements OnDestroy {
2222
private disposable: Subscription|undefined;
2323

2424
constructor(appRef: ApplicationRef) {
25-
if (started) {
25+
if (started && window.performance.mark) {
2626
this.disposable = appRef.isStable.pipe(
2727
first(it => it),
2828
tap(() => {

src/compat/performance/performance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class AngularFirePerformance {
5252
}
5353

5454
const trace$ = (traceId: string) => {
55-
if (typeof window !== 'undefined' && window.performance) {
55+
if (typeof window !== 'undefined' && window.performance && window.performance.mark) {
5656
const entries = window.performance.getEntriesByName(traceId, 'measure') || [];
5757
const startMarkName = `_${traceId}Start[${entries.length}]`;
5858
const endMarkName = `_${traceId}End[${entries.length}]`;

0 commit comments

Comments
 (0)
0