封鎖 >ContextMenuRegistry>註冊
註冊 RegistryItem。
Signature:
register(item: RegistryItem): void;
參數
參數 |
類型 |
說明 |
項目 |
RegistryItem |
要註冊的內容選單項目。 |
傳回:
void
例外狀況
{Error} (表示已有 ID 相同的項目)。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-09-12 (世界標準時間)。
[null,null,["上次更新時間:2024-09-12 (世界標準時間)。"],[[["Registers a context menu item, allowing it to be displayed in Blockly's context menus."],["Requires a RegistryItem object as input, defining the item's properties and behavior."],["Throws an error if attempting to register an item with an ID that's already in use."],["Successful registration makes the item available for inclusion within context menus."]]],["The `ContextMenuRegistry.register()` method adds a `RegistryItem` to the context menu. It accepts one parameter, `item`, which represents the context menu item being registered. This method returns nothing (`void`). If a menu item with the same ID already exists, the method throws an `Error`. The core action is the registration of a context menu item for later use.\n"]]