Skip to content

assertNoAdditionalChildren

Under Construction

This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/scenery/blob/main/js/util/assertNoAdditionalChildren.ts for the most up-to-date information.

Overview

A utility function that enforces that no additional Children are added to a Node.

In particular, useful for making sure that Nodes are not decorated with other content which can be problematic for dynamic layout. See https://github.com/phetsims/sun/issues/860.

Usage:

const myNode = new Node(); myNode.children = [ new Node(), new Node() ]; // fill in with your own content assertNoAdditionalChildren( myNode ); // prevent new children

Note that removals need to be allowed for disposal.

@author Jesse Greenberg

Source Code

See the source for assertNoAdditionalChildren.ts in the scenery repository.