ModuleManager
ModuleManager
class solves modules dependencies
active(module)
Set's .currentModule
to provided module
.
reset()
Set's .currentModule
to null
.
add(key, object, config[optional])
Adds dependency to .store
collection.
manager.add('hello', {world: true});
config object
property | description |
---|---|
alias | If string is provided - will add a referense to dependency from manager's handler. handler.[aliasValue] |
immutable | Set to false by default. Defines whether dependency can be overwrited by other modules. |
.get(key)
Returns dependency by it's key in store object
manager.get('hello'); // -> {world: true}
.has(key)
Returns a Boolean value. Whether manager has a dependency with the following key
.set(key, value)
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.
Updated almost 8 years ago