Created
February 17, 2021 11:21
-
-
Save danieltxok/5a2a23b620d3f320d30442b8cbe4c919 to your computer and use it in GitHub Desktop.
LCP Bookmarklet
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
javascript: | |
new PerformanceObserver((entryList)=>{ | |
for (const entry of entryList.getEntries()) { | |
let consoleGroup = `%cLCP candidate: ${Math.round(entry.startTime)}ms`; | |
let styles = ''; | |
if (entry.startTime >= 2500) { | |
styles = 'color: red;'; | |
} | |
console.group(consoleGroup, styles); | |
console.log('Element:', entry.element); | |
console.groupEnd(consoleGroup); | |
} | |
} | |
).observe({ | |
type: 'largest-contentful-paint', | |
buffered: true | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment