2016-11-22 03:11:33 +00:00
|
|
|
/**
|
|
|
|
* performance.now
|
|
|
|
*/
|
2017-04-28 02:13:22 +00:00
|
|
|
(function () {
|
2016-11-22 03:11:33 +00:00
|
|
|
|
2017-04-28 02:13:22 +00:00
|
|
|
if ('performance' in window === false)
|
|
|
|
{
|
|
|
|
window.performance = {};
|
2016-11-22 03:11:33 +00:00
|
|
|
}
|
|
|
|
|
2017-04-28 02:13:22 +00:00
|
|
|
// Thanks IE8
|
|
|
|
Date.now = (Date.now || function () {
|
|
|
|
return new Date().getTime();
|
|
|
|
});
|
|
|
|
|
|
|
|
if ('now' in window.performance === false)
|
|
|
|
{
|
|
|
|
var nowOffset = Date.now();
|
|
|
|
|
|
|
|
if (performance.timing && performance.timing.navigationStart)
|
|
|
|
{
|
|
|
|
nowOffset = performance.timing.navigationStart;
|
|
|
|
}
|
|
|
|
|
|
|
|
window.performance.now = function now ()
|
|
|
|
{
|
|
|
|
return Date.now() - nowOffset;
|
|
|
|
}
|
2016-11-22 03:11:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
})();
|