blockly > serialization > variables > VariableSerializer > clear
serialization.variables.VariableSerializer.clear() method
Disposes of any variables that exist on the workspace.
Signature:
clear(workspace: Workspace): void;
Parameters
Parameter |
Type |
Description |
workspace |
Workspace |
The workspace to clear the variables of. |
Returns:
void
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 `clear` method removes all variables associated with a specific workspace."],["It is part of the `VariableSerializer` class used for serializing and deserializing Blockly variables."],["This method takes the workspace to be cleared as its only parameter and does not return any value."]]],["The `VariableSerializer.clear()` method removes all variables from a specified workspace. It accepts one parameter, `workspace`, which is the target workspace. When called, it disposes of any existing variables within that workspace, effectively resetting the variables associated with it. The method returns `void`, indicating no specific return value.\n"]]