Pointers and Registrators
#
PointersA pointer in Brandi terminology is a unique value that is used for relating entities.
token<T>(description)
#
Creates a unique token with the type.
#
Argumentsdescription
:string
โ a description of the token to be used in logs and error messages.
#
ReturnsToken<T>
โ a unique token with the type.
#
Type SafetyThe token mechanism in Brandi provides type safety when binding and getting dependencies.
tag(description)
#
Creates a unique tag.
#
Argumentsdescription
:string
โ a description of the tag to be used in logs and error messages.
#
ReturnsTag
โ a unique tag.
#
Registratorsinjected(target, ...tokens)
#
Registers target injections.
#
Argumentstarget
โ constructor or function whose dependencies will be injected....tokens
:TokenValue[]
โ dependency tokens.
#
Returnstarget
โ the first argument.
#
ExampleApiService.ts
#
Type SafetyInjections in Brandi are strictly typed.
tokens.ts
ApiService.ts
tagged(target, ...tags)
#
Tags target. For more information about tags, see the Conditional Bindings documentation section.
#
Argumentstarget
โ constructor or function that will be tagged....tags
:Tag[]
โ tags.
#
Returnstarget
โ the first argument.
#
ExampleApiService.ts