Commit bcc57e46 authored by eddie's avatar eddie Committed by GitHub

fix: null check on elapsedTime for some browsers (#7213)

parent 8c731576
...@@ -2,7 +2,8 @@ ...@@ -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
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment