ModuleManager

core/ ModuleManager

.new ModuleManager(object)

Solves modules dependencies

Source:
Parameters:
Name Type Description
object Object

handler

Methods

(static) .add()

Source:

.active(module)

Sets .currentModule to provided module.

Source:
Parameters:
Name Type Description
module Object

the module to make current

.define(name)

Define the module in manager

Source:
Parameters:
Name Type Description
name

The module name

.get(key) → {Object|Module}

Returns dependency in store object, by key.

Source:
Parameters:
Name Type Description
key String

the key of the dependency

Throws:

if dependency is not in the store

Type
DependencyError
Example

Get the 'hello' dependency

manager.get('hello'); // -> {world: true}

.has(key) → {Boolean}

Returns whether manager has a dependency with the given key

Source:
Parameters:
Name Type Description
key String

the key of the dependency

Example

Check whether the store has the 'hello' dependency

manager.has('hello'); // -> true

.require(name, moduleExecutor)

Require module

Source:
Parameters:
Name Type Description
name String

Defined name

moduleExecutor function

Function that returns applied module

.reset()

Set's .currentModule to null.

Source:

.set(key, data)

An alias for .add()

Use this method if you know that you will overwrite existing dependency.
Use it in your app, but not in module that you provide to other people.

Source:
Parameters:
Name Type Description
key String

the key of the dependency

data Object

the value of the dependency

.update(depsMapopt)

Updates deps

Source:
Parameters:
Name Type Attributes Default Description
depsMap Object <optional>
{}

.use(name)

Get the defined module from manager

Source:
Parameters:
Name Type Description
name

The module name