Skip to content

Instantly share code, notes, and snippets.

@inian
Created July 20, 2015 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inian/2a16d5dd733ea649df43 to your computer and use it in GitHub Desktop.
Save inian/2a16d5dd733ea649df43 to your computer and use it in GitHub Desktop.
First Paint
timing = !!(typeof window.performance !== "undefined" && typeof window.performance.timing !== "undefined");
if (timing && timing.msFirstPaint && window.t_pagestart) {
t_firstpaint = timing.msFirstPaint - window.t_pagestart;
} else if (window.chrome && typeof window.chrome.loadTimes === 'function') {
t_firstpaint = window.chrome.loadTimes().firstPaintTime - window.chrome.loadTimes().startLoadTime;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment