Binding Types
toConstant(value)
#
Binds the token to the constant value.
#
Argumentsvalue
:TokenType<Token>
โ the value that will be bound to the token.
#
ExampletoInstance(creator)
#
Binds the token to an instance in one of the scopes.
#
Argumentscreator
:(new (...args: any[]) => TokenType<Token>) | ((...args: any[]) => TokenType<Token>)
โ the instance creator that will be bound to the token.
#
ReturnsBinding Scope syntax:
#
Examples#
Class Instance#
Function Call Result#
InjetionsIf the constructor or function has arguments you need to register dependencies
by injected
registrator.
toFactory(creator, [initializer])
#
Binds the token to the factory.
#
Argumentscreator
โ the instance creator which the factory will use;[initializer]
โ optional function called after the instance is created.