Stay organized with collections
Save and categorize content based on your preferences.
blockly > registry > getClassFromOptions
registry.getClassFromOptions() function
Gets the class from Blockly options for the given type. This is used for plugins that override a built in feature. (e.g. Toolbox)
Signature:
export declare function getClassFromOptions<T>(type: Type<T>, options: Options, opt_throwIfMissing?: boolean): (new (...p1: any[]) => T) | null;
Parameters
Parameter |
Type |
Description |
type |
Type<T> |
The type of the plugin. |
options |
Options |
The option object to check for the given plugin. |
opt_throwIfMissing |
boolean |
(Optional) Whether or not to throw an error if we are unable to find the plugin. |
Returns:
(new (...p1: any[]) => T) | null
The class for the plugin.
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.
[[["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 2024-09-18 UTC."],[[["Retrieves the class for a specified plugin type from Blockly options, enabling customization of built-in features."],["Accepts the plugin type, options object, and an optional flag to throw an error if the plugin is not found."],["Returns the plugin's class or null if not found, facilitating plugin integration and extension."]]],["The `registry.getClassFromOptions()` function retrieves a plugin's class from Blockly options based on its type. It takes the plugin's type, an options object, and an optional boolean to determine if an error should be thrown if the plugin is missing. It returns the plugin's class or `null` if not found. This is useful for plugins, like the Toolbox, which replace default functionality, and to find the given plugin on the option object.\n"]]