Sfoglia il codice sorgente

Merge pull request #10732 from WhitestormJS/dev

Add Clock support in node
Mr.doob 8 anni fa
parent
commit
8e4507d16d
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  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(); // see #10732
 
 		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;