研究调查问卷:请告诉我们您使用 Blockly 的体验
开始调查问卷
blockly >ContextMenuRegistry >注册
注册一个 RegistryItem。
Signature:
register(item: RegistryItem): void;
参数
参数 |
类型 |
说明 |
项 |
RegistryItem |
要注册的上下文菜单项。 |
返回:
void
异常
{Error}(如果已存在具有指定 ID 的内容)。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-09-12。
[null,null,["最后更新时间 (UTC):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"]]