Members
container :module:flitter-di/src/Container~Container
The service container used by this dependency injector.
- Source:
Methods
(private) __is_injectable(Class) → {boolean}
Verify that a class is injectable. This means that it has a static __inject method and that method takes at least one argument. In almost all cases, this should be satisfied by using the Injectable base class.
Name | Type | Description |
---|---|---|
Class |
* | the class to check |
- Source:
- true if the class is injectable
- Type
- boolean
get(name) → {*}
Fetch an IoC item by name.
Name | Type | Description |
---|---|---|
name |
string |
- Source:
- Type
- *
has(name) → {boolean}
Verify that the injector's container has a service or set of services.
Name | Type | Description |
---|---|---|
name |
string | Array.<string> | service name or array of service names |
- Source:
- true if the container has the service(s)
- Type
- boolean
inject(Class) → {*}
Inject the passed in Class with the IoC items it requires.
Name | Type | Description |
---|---|---|
Class |
- Source:
- Type
- *
inject_globally()
If called, this method will extend the global nodejs require() method to check for injectable classes. If a require value is injectable, it will be automatically injected with the services from this DI.
- Source:
make(Class, …args) → {*}
Instantiate the passed in class. If it is injectable, it will be injected.
Name | Type | Attributes | Description |
---|---|---|---|
Class |
|||
args |
* |
<repeatable> |
additional arguments to be passed to the constructor of the class |
- Source:
- the injected static reference to the Class
- Type
- *
service(name) → {module:flitter-di/src/Service~Service|undefined|Proxy}
Fetch a service by name. If no name is provided, return the service proxy container. This container has getters for all the services by name.
Name | Type | Description |
---|---|---|
name |
string | the name of the service |
- Deprecated:
- - prefer DependencyInjector.get. This will be removed in the future.
- Source:
- the service instance or service container proxy
- Type
- module:flitter-di/src/Service~Service | undefined | Proxy