Skip to content

Commit c45e33d

Browse files
authored
Check for window.performance.mark
For compatibility with test environments that replace window.performance
1 parent 8d69c9d commit c45e33d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/performance/performance.service.ts

Lines changed: 2 additions & 2 deletions
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(() => {

0 commit comments

Comments
 (0)