Просмотр исходного кода

Clock: Inline performance.now() (#31295)

林炳权 8 месяцев назад
Родитель
Сommit
4bb436e68e
1 измененных файлов с 2 добавлено и 8 удалено
  1. 2 8
      src/core/Clock.js

+ 2 - 8
src/core/Clock.js

@@ -61,7 +61,7 @@ class Clock {
 	 */
 	start() {
 
-		this.startTime = now();
+		this.startTime = performance.now();
 
 		this.oldTime = this.startTime;
 		this.elapsedTime = 0;
@@ -110,7 +110,7 @@ class Clock {
 
 		if ( this.running ) {
 
-			const newTime = now();
+			const newTime = performance.now();
 
 			diff = ( newTime - this.oldTime ) / 1000;
 			this.oldTime = newTime;
@@ -125,10 +125,4 @@ class Clock {
 
 }
 
-function now() {
-
-	return performance.now();
-
-}
-
 export { Clock };

粤ICP备19079148号