Skip to content

Commit

Permalink
fixed Common.now, closes #55
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed May 20, 2015
1 parent 41b4b7f commit 8555c0c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/core/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,19 @@ var Common = {};
Common.now = function() {
// http://stackoverflow.com/questions/221294/how-do-you-get-a-timestamp-in-javascript
// https://gist.github.com/davidwaterston/2982531

var perf = window.performance;

if (perf) {
perf.now = perf.now || perf.webkitNow || perf.msNow || perf.oNow || perf.mozNow;
return +(perf.now());
}

return +(new Date());
var performance = window.performance || {};

performance.now = (function() {
return performance.now ||
performance.webkitNow ||
performance.msNow ||
performance.oNow ||
performance.mozNow ||
function() { return +(new Date()); };
})();

return performance.now();
};


Expand Down

0 comments on commit 8555c0c

Please sign in to comment.