injust commented on a change in pull request #1802: Prefer Paint Timing API
over chrome.loadTimes()
URL:
https://github.com/apache/incubator-pagespeed-mod/pull/1802#discussion_r224996956
##########
File path: net/instaweb/rewriter/add_instrumentation.js
##########
@@ -95,6 +95,12 @@ pagespeed.AddInstrumentation.prototype.sendBeacon =
function() {
if (timingApi['msFirstPaint']) {
// IE.
firstPaintTime = timingApi['msFirstPaint'];
+ } else if (window['performance']['timeOrigin'] &&
+ window['performance']['getEntriesByName']('first-paint').length > 0) {
+ // Paint Timing API
+ firstPaintTime = Math.floor(
+ window.performance.timeOrigin +
+ window.performance.getEntriesByName('first-paint')[0].startTime);
Review comment:
I'm not sure how I would use a helper function for preventing chains of
dereferencing, could you clarify that bit?
I gave it a shot with temporary variables, but feel like there's a better
way of doing it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services