Skip to content

Commit 9d189b6

Browse files
committed
fix: Check for performance.timing in webworkers
1 parent 5f1179d commit 9d189b6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/utils/src/misc.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,15 @@ export const crossPlatformPerformance: Pick<Performance, 'now' | 'timeOrigin'> =
372372
}
373373

374374
if (getGlobalObject<Window>().performance) {
375+
// tslint:disable-next-line:deprecation
376+
if (!performance.timing) {
377+
return performanceFallback;
378+
}
379+
// tslint:disable-next-line:deprecation
380+
if (!performance.timing.navigationStart) {
381+
return performanceFallback;
382+
}
383+
375384
// Polyfill for performance.timeOrigin.
376385
//
377386
// While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin

0 commit comments

Comments
 (0)