فهرست منبع

use ES6 default params to simplify code (#21662)

* use ES6 default params to simplify code

* simplify code
john-keith 4 سال پیش
والد
کامیت
c9350382c5
2فایلهای تغییر یافته به همراه3 افزوده شده و 5 حذف شده
  1. 2 2
      src/core/Clock.js
  2. 1 3
      src/extras/core/Curve.js

+ 2 - 2
src/core/Clock.js

@@ -1,8 +1,8 @@
 class Clock {
 class Clock {
 
 
-	constructor( autoStart ) {
+	constructor( autoStart = true ) {
 
 
-		this.autoStart = ( autoStart !== undefined ) ? autoStart : true;
+		this.autoStart = autoStart;
 
 
 		this.startTime = 0;
 		this.startTime = 0;
 		this.oldTime = 0;
 		this.oldTime = 0;

+ 1 - 3
src/extras/core/Curve.js

@@ -106,9 +106,7 @@ class Curve {
 
 
 	// Get list of cumulative segment lengths
 	// Get list of cumulative segment lengths
 
 
-	getLengths( divisions ) {
-
-		if ( divisions === undefined ) divisions = this.arcLengthDivisions;
+	getLengths( divisions = this.arcLengthDivisions ) {
 
 
 		if ( this.cacheArcLengths &&
 		if ( this.cacheArcLengths &&
 			( this.cacheArcLengths.length === divisions + 1 ) &&
 			( this.cacheArcLengths.length === divisions + 1 ) &&