Namespace: registry

Class

Property

DEFAULT

constant   static

string

The string used to register the default class for a type of plugin.

Methods

getAllItems

static

getAllItems(type, opt_cased, opt_throwIfMissing) returns Object with (nullable T or nullable function(constructs T, repeatable unknown)) properties

Returns a map of items registered with the given type.

Parameter

type

(string or non-null Blockly.registry.Type containing T)

The type of the plugin. (e.g. Category)

opt_cased

boolean

Whether or not to return a map with cased keys (rather than caseless keys). False by default.

opt_throwIfMissing

Optional

boolean

Whether or not to throw an error if we are unable to find the object. False by default.

Returns

nullable Object with (nullable T or nullable function(constructs T, repeatable unknown)) properties A map of objects with the given type, or null if none exists.

getClass

static

getClass(type, name, opt_throwIfMissing) returns function()

Gets the class for the given name and type.

Parameter

type

(string or non-null Blockly.registry.Type containing T)

The type of the plugin. (e.g. Field, Renderer)

name

string

The plugin's name. (Ex. field_angle, geras)

opt_throwIfMissing

Optional

boolean

Whether or not to throw an error if we are unable to find the plugin.

Returns

nullable function(constructs T, repeatable unknown) The class with the given name and type or null if none exists.

getClassFromOptions

static

getClassFromOptions(type, options, opt_throwIfMissing) returns 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)

Parameter

type

Blockly.registry.Type containing T

The type of the plugin.

Value must not be null.

options

Blockly.Options

The option object to check for the given plugin.

Value must not be null.

opt_throwIfMissing

Optional

boolean

Whether or not to throw an error if we are unable to find the plugin.

Returns

nullable function(constructs T, repeatable unknown) The class for the plugin.

getObject

static

getObject(type, name, opt_throwIfMissing) returns T

Gets the object for the given name and type.

Parameter

type

(string or non-null Blockly.registry.Type containing T)

The type of the plugin. (e.g. Category)

name

string

The plugin's name. (Ex. logic_category)

opt_throwIfMissing

Optional

boolean

Whether or not to throw an error if we are unable to find the object.

Returns

nullable T The object with the given name and type or null if none exists.

hasItem

static

hasItem(type, name) returns boolean

Returns whether or not the registry contains an item with the given type and name.

Parameter

type

(string or non-null Blockly.registry.Type containing T)

The type of the plugin. (e.g. Field, Renderer)

name

string

The plugin's name. (Ex. field_angle, geras)

Returns

boolean True if the registry has an item with the given type and name, false otherwise.

register

static

register(type, name, registryItem, opt_allowOverrides)

Registers a class based on a type and name.

Parameter

type

(string or non-null Blockly.registry.Type containing T)

The type of the plugin. (e.g. Field, Renderer)

name

string

The plugin's name. (Ex. field_angle, geras)

registryItem

(nullable function(constructs T, repeatable unknown) or Object)

The class or object to register.

opt_allowOverrides

Optional

boolean

True to prevent an error when overriding an already registered item.

Throws

Error if the type or name is empty, a name with the given type has already been registered, or if the given class or object is not valid for its type.

unregister

static

unregister(type, name)

Unregisters the registry item with the given type and name.

Parameter

type

(string or non-null Blockly.registry.Type containing T)

The type of the plugin. (e.g. Field, Renderer)

name

string

The plugin's name. (Ex. field_angle, geras)