mirror of
https://github.com/photonstorm/phaser
synced 2025-01-11 04:38:51 +00:00
33 lines
674 B
JavaScript
33 lines
674 B
JavaScript
|
/**
|
||
|
* @copyright 2016 Photon Storm Ltd.
|
||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* performance.now
|
||
|
*/
|
||
|
(function(){
|
||
|
|
||
|
if ("performance" in window == false) {
|
||
|
window.performance = {};
|
||
|
}
|
||
|
|
||
|
Date.now = (Date.now || function () { // thanks IE8
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
})();
|