Last active
April 11, 2018 21:36
-
-
Save Zizzamia/e07ea7615b7ccb9ef7855575e8c0488c to your computer and use it in GitHub Desktop.
First Contentful Paint native demo
This file contains hidden or 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
<head> | |
<script> | |
const perfObserver = new PerformanceObserver((entryList) => { | |
console.log(...entryList.getEntries()); | |
}); | |
perfObserver.observe({entryTypes: ["paint"]}); | |
</script> | |
<style>body { background: #f2db77; ... }</style> | |
</head> | |
<body></body> | |
<script> | |
setTimeout(() => { | |
const elH1 = document.createElement('H1'); | |
elH1.textContent = 'First (Contentful) Paint'; | |
document.body.append(elH1); | |
}, 600); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment