Time to First Paint metrics
JohnRiv opened this issue · comments
Take a look at http://www.lognormal.com/blog/2013/11/11/calculating-first-paint/ and https://github.com/lognormal/boomerang/blob/master/plugins/navtiming.js and you'll see there are browser-specific ways to calculate first paint for recent versions of IE, Chrome & Firefox. Let's do the following:
- add a
getFirstPaint()
method to Surf-N-Perf that returns the browser's native calculation, ornull
if the browser doesn't have one - add a
getFirstPaintFrame()
method will return an estimated value based on Window.requestAnimationFrame.- I assume that's going to require adding some code to the block we require in the
<head>
of the document. - If
getFirstPaintFrame()
is called but the data is not available yet, returnundefined
NaN
- If
getFirstPaintFrame()
is called but the browser does not support Window.requestAnimationFrame, returnnull
- I assume that's going to require adding some code to the block we require in the
After we have that working:
- Add it to the JavaScript API page
- Add it to the Demo page