-
-
Save lelinhtinh/3a757dff57d369fa38417c30a9af4f9b to your computer and use it in GitHub Desktop.
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
// if Navigation Timing is not supported, fallback to Date.naw() called on start (sufficient in many cases) | |
// Date.now is also polyfilled | |
(function(p){ | |
if(!Date.now) | |
Date.now = function(){return +new Date}; | |
if (!p.now){ | |
var start = (p.timing && p.timing.navigationStart) || Date.now(); | |
p.now = function now(){ | |
return Date.now() - start; | |
}; | |
} | |
})( this.performance || ( this.performance = {} ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment