ElementRegistryClass

Domain/Factories~ ElementRegistryClass

A simple map storing factory functions for elements. Used for lookup when creating new elements based on their type.

Constructor

new ElementRegistryClass()

Source:

Methods

get(type) → {function}

Retrieves the factory function for a given element type.

Description:
  • Retrieves the factory function for a given element type.

Source:
Parameters:
Name Type Description
type string

The element type.

Returns:

The factory function.

Type
function

getTypes() → {Array.<string>}

Retrieves all registered element types.

Description:
  • Retrieves all registered element types.

Source:
Returns:

The list of element types.

Type
Array.<string>

register(type, factoryFunction)

Registers a new element type.

Description:
  • Registers a new element type.

Source:
Parameters:
Name Type Description
type string

The name of the element type.

factoryFunction function

The factory function for creating the element.