blockly > Connection > getShadowState
Connection.getShadowState() method
Returns the serialized object representation of the connection's shadow block.
Signature:
getShadowState(returnCurrent?: boolean): blocks.State | null;
Parameters
Parameter |
Type |
Description |
returnCurrent |
boolean |
(Optional) If true, and the shadow block is currently attached to this connection, this serializes the state of that block and returns it (so that field values are correct). Otherwise the saved state is just returned. |
Returns:
blocks.State | null
Serialized object representation of the block, or null.
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."],[[["`Connection.getShadowState()` returns a serialized representation of the connection's shadow block, which can be used to recreate the block."],["The method accepts an optional boolean parameter `returnCurrent` that, if true, serializes the current state of the attached shadow block, including field values."],["If `returnCurrent` is false or there's no attached shadow block, the method returns the previously saved state of the shadow block."],["The returned value is of type `blocks.State` or null if there's no serialized shadow block data."]]],["The `getShadowState` method retrieves the serialized representation of a connection's shadow block. It accepts an optional `returnCurrent` boolean parameter. If `returnCurrent` is true and a shadow block is attached, the method returns the current state of that block, including field values. Otherwise, it returns the saved state. The method outputs either a serialized object representation of the block (`blocks.State`) or `null` if no shadow block is associated.\n"]]