Last active
June 9, 2016 21:12
-
-
Save thewarpaint/8a9832984c167cde0f6484bac337b04a to your computer and use it in GitHub Desktop.
window.performance.timing
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
(function() { | |
var timingKeys = ['connectEnd', 'connectStart', 'domComplete', 'domContentLoadedEventEnd', 'domContentLoadedEventStart', | |
'domInteractive', 'domLoading', 'domainLookupEnd', 'domainLookupStart', 'fetchStart', 'loadEventEnd', 'loadEventStart', | |
'navigationStart', 'redirectEnd', 'redirectStart', 'requestStart', 'responseEnd', 'responseStart', 'unloadEventEnd', | |
'unloadEventStart']; | |
timingKeys | |
.map(function (key) { | |
return { | |
key: key, | |
value: window.performance.timing[key] | |
}; | |
}) | |
.sort(function (a, b) { | |
if(a.value > b.value) { | |
return 1; | |
} | |
if(a.value < b.value) { | |
return -1; | |
} | |
return 0; | |
}) | |
.forEach(function (metric) { | |
console.log(metric.key + ' at ' + metric.value); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment