jmarantz 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_r225510970
##########
File path: net/instaweb/rewriter/add_instrumentation.js
##########
@@ -88,21 +88,30 @@ pagespeed.AddInstrumentation.prototype.sendBeacon =
function() {
timingApi['responseEnd'] - timingApi['responseStart']);
url += '&dom_c=' + (timingApi['domContentLoadedEventStart'] -
navStartTime);
- if (window['performance']['navigation']) {
- url += '&nt=' + window['performance']['navigation']['type'];
+ if (winPerf['navigation']) {
+ url += '&nt=' + winPerf['navigation']['type'];
}
var firstPaintTime = -1;
+ var paintEntries, loadTimes;
if (timingApi['msFirstPaint']) {
// IE.
firstPaintTime = timingApi['msFirstPaint'];
- } else if (window['chrome'] && window['chrome']['loadTimes']) {
+ } else if (winPerf['timeOrigin'] &&
Review comment:
can you do the same trick here -- predeclaring vars for timeOrigin and
getEntriesByType and then assigning them in the if-statement as side effects.
That looks pretty readable.
----------------------------------------------------------------
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