Injection
Static Method Summary
Static Public Methods | ||
public static |
addProviders(classConstructors: *): void Registers classes as the default provider for their Provide annotation (set by @provide decorator). |
|
public static |
Requests an instance of the given class from the DI engine. |
|
public static |
Requests instances of multiple classes at once. |
|
public static |
Provide an instance a certain type. |
|
public static |
provideAndGet(classConstructor: Class, functionOrConstructedObject: Function | Object): * Provide an instance a certain type. |
Static Public Methods
public static addProviders(classConstructors: *): void source
Registers classes as the default provider for their Provide annotation (set by @provide decorator).
Example usage: addProviders(ArvaRouter, FamousContext);
Params:
Name | Type | Attribute | Description |
classConstructors | * |
Return:
void |
public static get(classConstructor: Function, constructionParams: *): Object source
Requests an instance of the given class from the DI engine. If an instance of that class with the same construction parameters already exists, a reference to it is returned. Otherwise a new instance is created.
Example usage: get(HomeController, param1, param2);
Params:
Name | Type | Attribute | Description |
classConstructor | Function | The class of which an instance is wanted |
|
constructionParams | * | A list of parameters to be passed to the class constructor |
public static getAll(classContructorArray: *): Array source
Requests instances of multiple classes at once.
Example usage: let instances = getAll(ArvaRouter, [HomeController, [param1, param2]], App);
Params:
Name | Type | Attribute | Description |
classContructorArray | * | Array of classes to instantiate. May also be an array where each item is an array containing the class as its first element, and an array of parameters as its second element. |