Created
February 17, 2021 11:22
-
-
Save danieltxok/e3c51768a5c3ea3f2a11c14b9b1c51cf to your computer and use it in GitHub Desktop.
FID 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()) { | |
const delay = entry.processingStart - entry.startTime; | |
let consoleGroup = `%cFID value: ${Math.round(delay)}ms`; | |
let styles = ''; | |
if (delay >= 100) { | |
styles = 'color: red;'; | |
} | |
console.group(consoleGroup, styles); | |
console.log(`Event name: ${entry.name}`); | |
console.log('Element:', entry.target); | |
console.groupEnd(consoleGroup); | |
} | |
} | |
).observe({ | |
type: 'first-input', | |
buffered: true | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment