Browse Source

NodeBuilder: Use `.sequentialNodes` as `Set` instead of Array (#33703)

mrdoob 3 weeks ago
parent
commit
3e99a6eab6
1 changed files with 3 additions and 7 deletions
  1. 3 7
      src/nodes/core/NodeBuilder.js

+ 3 - 7
src/nodes/core/NodeBuilder.js

@@ -145,9 +145,9 @@ class NodeBuilder {
 		 * This is used to determine the update order of nodes, which is important for
 		 * {@link NodeUpdateType#UPDATE_BEFORE} and {@link NodeUpdateType#UPDATE_AFTER}.
 		 *
-		 * @type {Array<Node>}
+		 * @type {Set<Node>}
 		 */
-		this.sequentialNodes = [];
+		this.sequentialNodes = new Set();
 
 		/**
 		 * A list of all nodes which {@link Node#update} method should be executed.
@@ -848,11 +848,7 @@ class NodeBuilder {
 
 		if ( updateBeforeType !== NodeUpdateType.NONE || updateAfterType !== NodeUpdateType.NONE ) {
 
-			if ( this.sequentialNodes.includes( node ) === false ) {
-
-				this.sequentialNodes.push( node );
-
-			}
+			this.sequentialNodes.add( node );
 
 		}
 

粤ICP备19079148号