MCPcopy Index your code
hub / github.com/github/docs / getPerformance

Function getPerformance

components/lib/events.ts:175–188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

173}
174
175function getPerformance() {
176 const paint = performance
177 ?.getEntriesByType('paint')
178 ?.find(({ name }) => name === 'first-contentful-paint')
179 const nav = performance?.getEntriesByType('navigation')?.[0] as
180 | PerformanceNavigationTiming
181 | undefined
182 return {
183 firstContentfulPaint: paint ? paint.startTime / 1000 : undefined,
184 domInteractive: nav ? nav.domInteractive / 1000 : undefined,
185 domComplete: nav ? nav.domComplete / 1000 : undefined,
186 render: nav ? (nav.responseEnd - nav.requestStart) / 1000 : undefined,
187 }
188}
189
190function trackScroll() {
191 // Throttle the calculations to no more than five per second

Callers 1

sendExitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected