fix: null check on elapsedTime for some browsers (#7213)
This commit is contained in:
parent
8c7315760a
commit
bcc57e4612
@ -2,7 +2,8 @@
|
|||||||
* Returns the time elapsed between page load and now.
|
* Returns the time elapsed between page load and now.
|
||||||
* @param markName the identifier for the performance mark to be created and measured.
|
* @param markName the identifier for the performance mark to be created and measured.
|
||||||
*/
|
*/
|
||||||
export function calculateElapsedTimeWithPerformanceMark(markName: string): number {
|
export function calculateElapsedTimeWithPerformanceMark(markName: string): number | undefined {
|
||||||
const elapsedTime = performance.mark(markName)
|
const elapsedTime = performance.mark(markName)
|
||||||
|
if (!elapsedTime) return undefined
|
||||||
return elapsedTime.startTime
|
return elapsedTime.startTime
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user