mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
fixed Common.now, closes #55
This commit is contained in:
parent
41b4b7f610
commit
8555c0c671
1 changed files with 12 additions and 8 deletions
|
@ -214,14 +214,18 @@ var Common = {};
|
||||||
// http://stackoverflow.com/questions/221294/how-do-you-get-a-timestamp-in-javascript
|
// http://stackoverflow.com/questions/221294/how-do-you-get-a-timestamp-in-javascript
|
||||||
// https://gist.github.com/davidwaterston/2982531
|
// https://gist.github.com/davidwaterston/2982531
|
||||||
|
|
||||||
var perf = window.performance;
|
var performance = window.performance || {};
|
||||||
|
|
||||||
if (perf) {
|
performance.now = (function() {
|
||||||
perf.now = perf.now || perf.webkitNow || perf.msNow || perf.oNow || perf.mozNow;
|
return performance.now ||
|
||||||
return +(perf.now());
|
performance.webkitNow ||
|
||||||
}
|
performance.msNow ||
|
||||||
|
performance.oNow ||
|
||||||
|
performance.mozNow ||
|
||||||
|
function() { return +(new Date()); };
|
||||||
|
})();
|
||||||
|
|
||||||
return +(new Date());
|
return performance.now();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue