Skip to content

Instantly share code, notes, and snippets.

@junosuarez
Created August 16, 2016 17:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save junosuarez/ccef635056fc84f5452f36f8eb6681db to your computer and use it in GitHub Desktop.
Save junosuarez/ccef635056fc84f5452f36f8eb6681db to your computer and use it in GitHub Desktop.
key RUM perf metric: time-to-first-jank
if (window.requestAnimationFrame) {
function checkForJank () { // eslint-disable-line no-inner-delcarations
const frameStart = Date.now()
window.requestAnimationFrame(() => {
const frameDuration = Date.now() - frameStart
if (frameDuration > 17) {
Perf.log(FirstJank)
} else {
checkForJank()
}
})
}
checkForJank()
}
@junosuarez
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment