소스 검색

Add Clock support in node

Alexander Buzin 8 년 전
부모
커밋
68c57aa9c9
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  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;