blockly > Connexion > getShadowState
Méthode Connection.getShadowState()
Renvoie la représentation d'objet sérialisée du bloc fantôme de la connexion.
Signature :
getShadowState(returnCurrent?: boolean): blocks.State | null;
Paramètres
Paramètre |
Type |
Description |
returnCurrent |
booléen |
(Facultatif) Si la valeur est "true" et que le bloc fantôme est actuellement associé à cette connexion, sérialise l'état de ce bloc et le renvoie (afin que les valeurs des champs soient correctes). Sinon, l'état enregistré est simplement renvoyé. |
Renvoie :
blocks.State | nul
Représentation de l'objet sérialisée du bloc, ou valeur nulle.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2024/08/29 (UTC).
[null,null,["Dernière mise à jour le 2024/08/29 (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"]]