Skip to content

Commit 8555c0c

Browse files
committed
fixed Common.now, closes #55
1 parent 41b4b7f commit 8555c0c

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

src/core/Common.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,19 @@ var Common = {};
213213
Common.now = function() {
214214
// http://stackoverflow.com/questions/221294/how-do-you-get-a-timestamp-in-javascript
215215
// https://gist.github.com/davidwaterston/2982531
216-
217-
var perf = window.performance;
218216

219-
if (perf) {
220-
perf.now = perf.now || perf.webkitNow || perf.msNow || perf.oNow || perf.mozNow;
221-
return +(perf.now());
222-
}
223-
224-
return +(new Date());
217+
var performance = window.performance || {};
218+
219+
performance.now = (function() {
220+
return performance.now ||
221+
performance.webkitNow ||
222+
performance.msNow ||
223+
performance.oNow ||
224+
performance.mozNow ||
225+
function() { return +(new Date()); };
226+
})();
227+
228+
return performance.now();
225229
};
226230

227231

0 commit comments

Comments
 (0)