Methods
buildPrototypeChain(prototype) → {Array}
Will traverse the prototype chain recursively up to the top and convert it to an array.
Parameters:
Name | Type | Description |
---|---|---|
prototype |
Object | The prototype to build a chain for |
- Source:
Returns:
An array with all prototypes of the chain ordered from bottom to top.
- Type
- Array
require(module, root, requestId) → {PrototypeWrap}
Will wrap the node require and inject prototype proxies for the dependency injection.
Parameters:
Name | Type | Description |
---|---|---|
module |
String | The path of the module to require |
root |
String | The identifier of the tree to work in |
requestId |
String | The id of the current injection request |
- Source:
Returns:
An Object containing the resolved prototype and the original chain
- Type
- PrototypeWrap
restoreOriginalPrototypeChain(originalChain)
After instantiation of the module it is important to restore the original prototype tree, since node will somehow cache it, which will lead to problems when traversing the tree again.
Parameters:
Name | Type | Description |
---|---|---|
originalChain |
Array | The original prototype chain as an Array |
wrapPrototype(prototype, root, requestId) → {Object}
Will wrap a prototype in a proxy, that will inject the dependencies into the original prototype constructor.
Parameters:
Name | Type | Description |
---|---|---|
prototype |
Object | The prototype to wrap |
root |
String | The identifier of the tree to work in |
requestId |
String | The id of the current injection request |
- Source:
Returns:
The wrapped prototype
- Type
- Object