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