ComponentManager

ComponentManager

A component manager is a collection of components. The ComponentManager is responsible for managing their lifecycle.

Constructor

new ComponentManager()

Source:

Methods

clear()

Source:

Removes all components and types

config(name, feature, valueopt) → {Any}

Source:

Configures the named component. The behavior of this is largely defined by the component that and the feature of that component that is being configured.

Parameters:
Name Type Attributes Description
name String

The name of the component to configure

feature String

The feature of the component to configure

value Any <optional>

The specified value for the feature, or undefined if not needed

Returns:

The value returned by the feature that was configured.

Type
Any

get(name) → {Object|function}

Source:

Gets a component by its name

Parameters:
Name Type Description
name String

The name of the component to retreive

Returns:

The compontent Object or Function, or undefined if the component was not found

Type
Object | function

getType(typeName) → {Object}

Source:

Looks up a type by its name

Parameters:
Name Type Description
typeName String

The name of the type to be retreived

Returns:

The type Object that was found, or undefined if no matching type was found

Type
Object

init() → {Promise.<undefined>}

Source:

Initializes all registered components

Returns:

A Promise that resolves when all the component initializations have completed

Type
Promise.<undefined>

register(name, type, objectOrFn)

Source:

Registers a new component

Parameters:
Name Type Description
name String

[description]

type String

[description]

objectOrFn Object | function

[description]

Throws:
  • If any parameters were of the wrong type

    Type
    TypeError
  • If the specified type was not found, or the objectOrFn was not of the right type

    Type
    Error

registerType(typeName, validationFn)

Source:

Registers a new type

Parameters:
Name Type Description
typeName String

The name of the new type to register

validationFn function

The function that will be used to validate components that claim to be this type

setDataDir(dir)

Source:

Sets the directory that components should use for storing data. Path will be resolved to a real path with no symbolic links.

Parameters:
Name Type Description
dir String

The directory that will be used for storing data

Throws:
  • If the dir parameter is not a string

    Type
    TypeError
  • If the directory does not exist

    Type
    Error

shutdown()

Source:
To Do:
  • Not implemented

In theory this shuts down components