blockly > LineCursor > getPreviousNode

LineCursor.getPreviousNode() method

Get the previous node in the AST, optionally allowing for loopback.

Signature:

getPreviousNode(node: IFocusableNode | null, isValid: (p1: IFocusableNode | null) => boolean, loop: boolean): IFocusableNode | null;

Parameters

Parameter Type Description
node IFocusableNode | null The current position in the AST.
isValid (p1: IFocusableNode | null) => boolean A function true/false depending on whether the given node should be traversed.
loop boolean Whether to loop around to the end of the workspace if no valid node was found.

Returns:

IFocusableNode | null

The previous node in the traversal or null if no previous node exists.