blockly > Workspace > newBlock
Workspace.newBlock() method
Obtain a newly created block.
Signature:
newBlock(prototypeName: string, opt_id?: string): Block;
Parameters
Parameter |
Type |
Description |
prototypeName |
string |
Name of the language object containing type-specific functions for this block. |
opt_id |
string |
(Optional) Optional ID. Use this ID if provided, otherwise create a new ID. |
Returns:
Block
The created block.
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 `Workspace.newBlock()` method creates a new block within a Blockly workspace."],["It requires the `prototypeName` to define the block's type and an optional `opt_id` for specific identification."],["The method returns the newly created `Block` object for further manipulation within the workspace."]]],[]]