ModuleSystem

core/ ModuleSystem

.new ModuleSystem()

Provides API for classes that will use Modules.
This class includes basic event system with those supported methods:

.on()
.off()
.emit()
Source:

Extends Events

Methods

.applyBridge(bridgeMap) → {Object}

Makes component-specific API to work with modules.

Source:
Parameters:
Name Type Description
bridgeMap Object

.applyCommand(name, cbopt)

.applyCommand runs a method called name on all modules.

Source:
Parameters:
Name Type Attributes Default Description
name String

the method name.

cb function <optional>
(func, moduleScope) => func.apply(this, [moduleScope])

How the function is wrapped/

.applyModule(module, pushopt) → {Object}

.applyModule is also used in .integrateModules() function. It does exactly what its name says (applies module to component or app).

Source:
Parameters:
Name Type Attributes Default Description
module Object

the module to apply

push Boolean <optional>
true
Throws:
ManagerError

.disposeModule(module) → {Module}

Disposes of the given module

Source:
Parameters:
Name Type Description
module Object

the module to dispose

.disposeModules()

Disposes of all modules

Source:

.integrateModules(sourceopt)

This method applies all modules from .modules collection.

Source:
Parameters:
Name Type Attributes Description
source Object <optional>

If source (should be a component) is provided, will replace .modules with source's one before executing modules.

.module(module) → {this}

piped version of .applyModule().

Source:
Parameters:
Name Type Description
module Object

the module to apply

Throws:
ManagerError
Example

Piped modules

component
  .module(new Module1())
  .module(new Module2())
  .module(new Module3())