Created
October 18, 2017 08:23
-
-
Save jbmoelker/af066fedeb121736faba454e1a76cfa6 to your computer and use it in GitHub Desktop.
Paint timings table: log performance paint metrics to the console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ('performance' in window) { | |
window.addEventListener('load', function () { | |
var paintMetrics = performance.getEntriesByType('paint'); | |
if (paintMetrics !== undefined && paintMetrics.length > 0){ | |
console.table(paintMetrics.map(function(metric) { | |
return { | |
event: metric.name, | |
startTime: metric.startTime.toFixed(2) + ' ms', | |
duration: metric.duration + ' ms' | |
} | |
})); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment