blockly > BasicCursor > getPreviousNode_
BasicCursor.getPreviousNode_() method
Reverses the pre order traversal in order to find the previous node. This will allow a user to easily navigate the entire Blockly AST without having to go in and out levels on the tree.
Signature:
protected getPreviousNode_(node: ASTNode | null, isValid: (p1: ASTNode | null) => boolean): ASTNode | null;
Parameters
Parameter | Type | Description |
---|---|---|
node | ASTNode | null | The current position in the AST. |
isValid | (p1: ASTNode | null) => boolean | A function true/false depending on whether the given node should be traversed. |
Returns:
ASTNode | null
The previous node in the traversal or null if no previous node exists.