blockly > ContextMenuRegistry > zarejestruj się
Rejestruje element RegistryItem.
Podpis:
register(item: RegistryItem): void;
Parametry
Parametr |
Typ |
Opis |
element |
RegistryItem |
Pozycja menu kontekstowego do zarejestrowania. |
Zwroty:
nieważne
Wyjątki
{Błąd}, jeśli element o podanym identyfikatorze już istnieje.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-09-12 UTC.
[null,null,["Ostatnia aktualizacja: 2024-09-12 UTC."],[[["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"]]