Container

Kind: global class

container.class(name, definition, …deps)

Register a class that could have more than one instance

Kind: instance method of Container

Param Type Description
name String Name for the dependency
definition function Class constructor
…deps String Dependencies to resolve into constructor call

container.singleton(name, definition, …deps)

Register a class that should have at most one instance

Kind: instance method of Container

Param Type Description
name String Name for the dependency
definition function Class constructor
…deps String Dependencies to resolve into constructor call

container.factory(name, definition, …deps)

Register a factory

Kind: instance method of Container

Param Type Description
name String Name for the dependency
definition function Factory function
…deps String Dependencies to resolve into factory call

container.literal(name, definition)

Register a literal value into container

Kind: instance method of Container

Param Type Description
name String Name for the dependency
definition \* The item value

container.get(name) ⇒ Object

Get a resolved dependency

Kind: instance method of Container

Param Type Description
name String Dependency name

container.resolve(fn, …dependencies)

Call the given function within the requested dependencies resolved

Kind: instance method of Container

Param Type Description
fn function Function to call within deps
…dependencies Array.<String> List of dependencies to resolve

Container~depDescriptor(name, Definition, deps, type) ⇒ Descriptor

Descriptor for dependencies

Kind: inner method of Container
Returns: Descriptor - A descriptor representing a dependency

Param Type Description
name String Dependency’s name
Definition \* Dependency’s contructor or factory or literal
deps Array.<String> Dependencies to resolve into constructor or factory call
type Symbol Symbol for the type

Container~Descriptor : Object

A descriptor representing a dependency

Kind: inner typedef of Container
Properties

Name Type Description
name String Dependency’s name
definition \* Dependency’s contructor or factory or literal
deps Array.<String> Dependencies to resolve into constructor or factory call
type Symbol Symbol for the type