Explorar o código

Add Clock support in node

Alexander Buzin %!s(int64=8) %!d(string=hai) anos
pai
achega
68c57aa9c9
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/core/Clock.js

+ 2 - 2
src/core/Clock.js

@@ -18,7 +18,7 @@ Object.assign( Clock.prototype, {
 
 	start: function () {
 
-		this.startTime = ( performance || Date ).now();
+		this.startTime = ( typeof performance === 'undefined' ? Date : performance ).now();
 
 		this.oldTime = this.startTime;
 		this.elapsedTime = 0;
@@ -52,7 +52,7 @@ Object.assign( Clock.prototype, {
 
 		if ( this.running ) {
 
-			var newTime = ( performance || Date ).now();
+			var newTime = ( typeof performance === 'undefined' ? Date : performance ).now();
 
 			diff = ( newTime - this.oldTime ) / 1000;
 			this.oldTime = newTime;