Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions packages/utils/src/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,19 +378,11 @@ export const crossPlatformPerformance: Pick<Performance, 'now' | 'timeOrigin'> =
// is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.
// tslint:disable-next-line:strict-type-predicates
if (performance.timeOrigin === undefined) {
// For webworkers it could mean we don't have performance.timing then we fallback
// tslint:disable-next-line:deprecation
if (!performance.timing) {
return performanceFallback;
}
// tslint:disable-next-line:deprecation
if (!performance.timing.navigationStart) {
return performanceFallback;
}

// As of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always a
// valid fallback. In the absence of a initial time provided by the browser, fallback to INITIAL_TIME.
// @ts-ignore
// tslint:disable-next-line:deprecation
performance.timeOrigin = performance.timing.navigationStart;
performance.timeOrigin = (performance.timing && performance.timing.navigationStart) || INITIAL_TIME;
}
}

Expand Down