blockly > Block > getDescendants
Block.getDescendants() method
Find all the blocks that are directly or indirectly nested inside this one. Includes this block in the list. Includes value and statement inputs, as well as any following statements. Excludes any connection on an output tab or any preceding statements. Blocks are optionally sorted by position; top to bottom.
Signature:
getDescendants(ordered: boolean): this[];
Parameters
Parameter |
Type |
Description |
ordered |
boolean |
Sort the list if true. |
Returns:
this[]
Flattened array of blocks.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `getDescendants()` method retrieves all blocks nested directly or indirectly within a given block, including the block itself, value and statement inputs, and following statements, but excluding output connections and preceding statements."],["The returned list is a flattened array of blocks and can be optionally sorted by position from top to bottom using the `ordered` boolean parameter."]]],["The `Block.getDescendants()` method retrieves all blocks nested within a given block, including the block itself. It encompasses blocks connected to value and statement inputs, and subsequent statements, while excluding those on output tabs or preceding statements. The method accepts an optional boolean parameter, `ordered`, to sort the resulting list of blocks by their position (top-to-bottom). It returns a flattened array of the descendant blocks.\n"]]