Wiki source code of Front-End Component Manager Annotations API
Last modified by Manuel Leduc on 2026/05/12 15:27
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | == injectable() == | ||
| 2 | |||
| 3 | {{code language="typescript"}} | ||
| 4 | function injectable(): ClassDecorator | ||
| 5 | {{/code}} | ||
| 6 | |||
| 7 | Marks a class as eligible for instantiation by the component container. | ||
| 8 | |||
| 9 | **Returns:** A ##ClassDecorator## that registers the target class with Inversify metadata. | ||
| 10 | |||
| 11 | == inject(id) == | ||
| 12 | |||
| 13 | {{code language="typescript"}} | ||
| 14 | function inject(id: symbol): ParameterDecorator | ||
| 15 | {{/code}} | ||
| 16 | |||
| 17 | Injects a single dependency identified by ##id## into a constructor parameter. | ||
| 18 | |||
| 19 | **Parameters:** | ||
| 20 | |||
| 21 | |=Name|=Type|=Description | ||
| 22 | |id|symbol|The role symbol identifying the dependency to inject. | ||
| 23 | |||
| 24 | **Returns:** A ##ParameterDecorator## applied to a constructor parameter. | ||
| 25 | |||
| 26 | **Notes:** | ||
| 27 | |||
| 28 | * If multiple bindings exist for ##id##, combine with ##@named## to disambiguate, or use ##@injectAll## to receive all of them. | ||
| 29 | |||
| 30 | == named(name) == | ||
| 31 | |||
| 32 | {{code language="typescript"}} | ||
| 33 | function named(name: string): ParameterDecorator | ||
| 34 | {{/code}} | ||
| 35 | |||
| 36 | Selects a specific binding by name when several implementations are bound to the same role identifier. | ||
| 37 | |||
| 38 | **Parameters:** | ||
| 39 | |||
| 40 | |=Name|=Type|=Description | ||
| 41 | |name|string|The binding name to match. | ||
| 42 | |||
| 43 | **Returns:** A ##ParameterDecorator## applied to a constructor parameter. | ||
| 44 | |||
| 45 | **Notes:** | ||
| 46 | |||
| 47 | * Typically composed with ##@inject(role)## on the same parameter. | ||
| 48 | |||
| 49 | == injectAll(id) == | ||
| 50 | |||
| 51 | {{code language="typescript"}} | ||
| 52 | function injectAll(id: symbol): ParameterDecorator | ||
| 53 | {{/code}} | ||
| 54 | |||
| 55 | Injects every component bound to the role ##id## as an array. | ||
| 56 | |||
| 57 | **Parameters:** | ||
| 58 | |||
| 59 | |=Name|=Type|=Description | ||
| 60 | |id|symbol|The role symbol of the bindings to collect. | ||
| 61 | |||
| 62 | **Returns:** A ##ParameterDecorator## applied to a constructor parameter. |