瀏覽代碼

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 {
 
-	constructor( autoStart ) {
+	constructor( autoStart = true ) {
 
-		this.autoStart = ( autoStart !== undefined ) ? autoStart : true;
+		this.autoStart = autoStart;
 
 		this.startTime = 0;
 		this.oldTime = 0;

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

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