Stay organized with collections
Save and categorize content based on your preferences.
blockly > ContextMenuRegistry
Class for the registry of context menu items. This is intended to be a singleton. You should not create a new instance, and only access this class from ContextMenuRegistry.registry.
Signature:
export declare class ContextMenuRegistry
Constructors
Constructor |
Modifiers |
Description |
(constructor)() |
|
Resets the existing singleton instance of ContextMenuRegistry. |
Properties
Methods
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 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eContextMenuRegistry\u003c/code\u003e class manages context menu items in Blockly and is designed as a singleton, accessed via \u003ccode\u003eContextMenuRegistry.registry\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods for registering, unregistering, and retrieving context menu items, as well as getting context menu options based on scope.\u003c/p\u003e\n"],["\u003cp\u003eThe registry can be reset to its initial state using the \u003ccode\u003ereset()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers interact with the singleton instance rather than creating new instances of the class.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [ContextMenuRegistry](./blockly.contextmenuregistry_class.md)\n\nContextMenuRegistry class\n-------------------------\n\nClass for the registry of context menu items. This is intended to be a singleton. You should not create a new instance, and only access this class from ContextMenuRegistry.registry.\n\n**Signature:** \n\n export declare class ContextMenuRegistry \n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|---------------------------------------------------------------------------------------|-----------|----------------------------------------------------------------|\n| [(constructor)()](./blockly.contextmenuregistry_class._constructor__1_constructor.md) | | Resets the existing singleton instance of ContextMenuRegistry. |\n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|----------------------------------------------------------------------|-----------|---------------------------------------------------------------|-------------|\n| [registry](./blockly.contextmenuregistry_class.registry_property.md) | `static` | [ContextMenuRegistry](./blockly.contextmenuregistry_class.md) | |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|----------------------------------------------------------------------------------------------------------------------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| [getContextMenuOptions(scope, menuOpenEvent)](./blockly.contextmenuregistry_class.getcontextmenuoptions_1_method.md) | | Gets the valid context menu options for the given scope. Options are only included if the preconditionFn shows they should not be hidden. |\n| [getItem(id)](./blockly.contextmenuregistry_class.getitem_1_method.md) | | |\n| [register(item)](./blockly.contextmenuregistry_class.register_1_method.md) | | Registers a RegistryItem. |\n| [reset()](./blockly.contextmenuregistry_class.reset_1_method.md) | | Clear and recreate the registry. |\n| [unregister(id)](./blockly.contextmenuregistry_class.unregister_1_method.md) | | Unregisters a RegistryItem with the given ID. |"]]