Injector
Hierarchy
Container
Container
↳ Injector
Implements
- Container
- Injector
- Container
- Injector
Index
Constructors
Properties
Methods
- applyCustomMetadataReader
- applyMiddleware
- bind
- createChild
- findByScope
- get
- getAll
- getAllAsync
- getAllNamed
- getAllNamedAsync
- getAllTagged
- getAllTaggedAsync
- getAsync
- getNamed
- getNamedAsync
- getTagged
- getTaggedAsync
- injectInto
- injectIntoAsync
- isBound
- isBoundNamed
- isBoundTagged
- load
- loadAsync
- onActivation
- onDeactivation
- rebind
- resolve
- restore
- snapshot
- unbind
- unbindAll
- unbindAllAsync
- unbindAsync
- unload
- merge
Constructors
constructor
+ new Injector(containerOptions?
: ContainerOptions): Injector
Inherited from Injector.constructor
Overrides Injector.constructor
Parameters:
Name | Type |
---|---|
containerOptions? | ContainerOptions |
Returns: Injector
Properties
id
• id: number
Readonly
options
• options: ContainerOptions
Implementation of Injector.options
Inherited from Injector.options
parent
• parent: Container | null
Implementation of Injector.parent
Inherited from Injector.parent
Methods
applyCustomMetadataReader
▸ applyCustomMetadataReader(metadataReader
: MetadataReader): void
Implementation of Injector
Inherited from Injector.applyCustomMetadataReader
Overrides Injector.applyCustomMetadataReader
Parameters:
Name | Type |
---|---|
metadataReader | MetadataReader |
Returns: void
applyMiddleware
▸ applyMiddleware(...middlewares
: interfaces.Middleware[]): void
Implementation of Injector
Inherited from Injector.applyMiddleware
Overrides Injector.applyMiddleware
Parameters:
Name | Type |
---|---|
...middlewares | interfaces.Middleware[] |
Returns: void
bind
▸ bind‹T›(serviceIdentifier
: inversifyTypes.ServiceIdentifier‹T›): inversifyTypes.BindingToSyntax‹T› & object
Implementation of Injector
Overrides void
[OVERRIDE] Registers a type binding
Type parameters:
▪ T
Parameters:
Name | Type | Description |
---|---|---|
serviceIdentifier | inversifyTypes.ServiceIdentifier‹T› | Identifier for a service. |
Returns: inversifyTypes.BindingToSyntax‹T› & object
Instance implementing BindingToSyntax
with additional toRoute
method.
createChild
▸ createChild(containerOptions?
: ContainerOptions): Container
Inherited from Injector.createChild
Overrides Injector.createChild
Parameters:
Name | Type |
---|---|
containerOptions? | ContainerOptions |
Returns: Container
findByScope
▸ findByScope(scope
: inversifyTypes.BindingScope): inversifyTypes.ServiceIdentifier‹any›[]
Implementation of Injector
Finds service identifiers by scope.
Parameters:
Name | Type | Description |
---|---|---|
scope | inversifyTypes.BindingScope | One of supported scopes by Inversify. |
Returns: inversifyTypes.ServiceIdentifier‹any›[]
List of service identifiers binding with provided scope.
get
▸ get‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›): T
Implementation of Injector
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
Returns: T
getAll
▸ getAll‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›): T[]
Implementation of Injector
Inherited from Injector.getAll
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
Returns: T[]
getAllAsync
▸ getAllAsync‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›): Promise‹T›[]
Implementation of Injector
Inherited from Injector.getAllAsync
Overrides Injector.getAllAsync
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
Returns: Promise‹T›[]
getAllNamed
▸ getAllNamed‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›, named
: string | number | symbol): T[]
Implementation of Injector
Inherited from Injector.getAllNamed
Overrides Injector.getAllNamed
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
named | string | number | symbol |
Returns: T[]
getAllNamedAsync
▸ getAllNamedAsync‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›, named
: string | number | symbol): Promise‹T›[]
Implementation of Injector
Inherited from Injector.getAllNamedAsync
Overrides Injector.getAllNamedAsync
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
named | string | number | symbol |
Returns: Promise‹T›[]
getAllTagged
▸ getAllTagged‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›, key
: string | number | symbol, value
: any): T[]
Implementation of Injector
Inherited from Injector.getAllTagged
Overrides Injector.getAllTagged
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
key | string | number | symbol |
value | any |
Returns: T[]
getAllTaggedAsync
▸ getAllTaggedAsync‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›, key
: string | number | symbol, value
: any): Promise‹T›[]
Implementation of Injector
Inherited from Injector.getAllTaggedAsync
Overrides Injector.getAllTaggedAsync
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
key | string | number | symbol |
value | any |
Returns: Promise‹T›[]
getAsync
▸ getAsync‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›): Promise‹T›
Implementation of Injector
Inherited from Injector.getAsync
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
Returns: Promise‹T›
getNamed
▸ getNamed‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›, named
: string | number | symbol): T
Implementation of Injector
Inherited from Injector.getNamed
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
named | string | number | symbol |
Returns: T
getNamedAsync
▸ getNamedAsync‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›, named
: string | number | symbol): Promise‹T›
Implementation of Injector
Inherited from Injector.getNamedAsync
Overrides Injector.getNamedAsync
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
named | string | number | symbol |
Returns: Promise‹T›
getTagged
▸ getTagged‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›, key
: string | number | symbol, value
: any): T
Implementation of Injector
Inherited from Injector.getTagged
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
key | string | number | symbol |
value | any |
Returns: T
getTaggedAsync
▸ getTaggedAsync‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›, key
: string | number | symbol, value
: any): Promise‹T›
Implementation of Injector
Inherited from Injector.getTaggedAsync
Overrides Injector.getTaggedAsync
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
key | string | number | symbol |
value | any |
Returns: Promise‹T›
injectInto
▸ injectInto(value
: any): void
Implementation of Injector
Synchronously injects dependencies from IoC container to existing value.
remarks
Supports @postConstruct
decorator.
Parameters:
Name | Type | Description |
---|---|---|
value | any | Value to which dependencies should be injected. |
Returns: void
injectIntoAsync
▸ injectIntoAsync(value
: any): Promise‹void›
Implementation of Injector
Asynchronously injects dependencies from IoC container to existing value.
remarks
Supports async @postConstruct
decorator.
Parameters:
Name | Type | Description |
---|---|---|
value | any | Value to which dependencies should be injected. |
Returns: Promise‹void›
isBound
▸ isBound(serviceIdentifier
: interfaces.ServiceIdentifier‹any›): boolean
Implementation of Injector
Inherited from Injector.isBound
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹any› |
Returns: boolean
isBoundNamed
▸ isBoundNamed(serviceIdentifier
: interfaces.ServiceIdentifier‹any›, named
: string | number | symbol): boolean
Implementation of Injector
Inherited from Injector.isBoundNamed
Overrides Injector.isBoundNamed
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹any› |
named | string | number | symbol |
Returns: boolean
isBoundTagged
▸ isBoundTagged(serviceIdentifier
: interfaces.ServiceIdentifier‹any›, key
: string | number | symbol, value
: any): boolean
Implementation of Injector
Inherited from Injector.isBoundTagged
Overrides Injector.isBoundTagged
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹any› |
key | string | number | symbol |
value | any |
Returns: boolean
load
▸ load(...modules
: ContainerModule[]): void
Implementation of Injector
Parameters:
Name | Type |
---|---|
...modules | ContainerModule[] |
Returns: void
loadAsync
▸ loadAsync(...modules
: AsyncContainerModule[]): Promise‹void›
Implementation of Injector
Inherited from Injector.loadAsync
Parameters:
Name | Type |
---|---|
...modules | AsyncContainerModule[] |
Returns: Promise‹void›
onActivation
▸ onActivation‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›, onActivation
: interfaces.BindingActivation‹T›): void
Implementation of Injector
Inherited from Injector.onActivation
Overrides Injector.onActivation
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
onActivation | interfaces.BindingActivation‹T› |
Returns: void
onDeactivation
▸ onDeactivation‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›, onDeactivation
: interfaces.BindingDeactivation‹T›): void
Implementation of Injector
Inherited from Injector.onDeactivation
Overrides Injector.onDeactivation
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
onDeactivation | interfaces.BindingDeactivation‹T› |
Returns: void
rebind
▸ rebind‹T›(serviceIdentifier
: interfaces.ServiceIdentifier‹T›): BindingToSyntax‹T›
Implementation of Injector
Inherited from Injector.rebind
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹T› |
Returns: BindingToSyntax‹T›
resolve
▸ resolve‹T›(constructorFunction
: interfaces.Newable‹T›): T
Implementation of Injector
Inherited from Injector.resolve
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
constructorFunction | interfaces.Newable‹T› |
Returns: T
restore
▸ restore(): void
Implementation of Injector
Inherited from Injector.restore
Returns: void
snapshot
▸ snapshot(): void
Implementation of Injector
Inherited from Injector.snapshot
Returns: void
unbind
▸ unbind(serviceIdentifier
: interfaces.ServiceIdentifier‹any›): void
Implementation of Injector
Inherited from Injector.unbind
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹any› |
Returns: void
unbindAll
▸ unbindAll(): void
Implementation of Injector
Inherited from Injector.unbindAll
Returns: void
unbindAllAsync
▸ unbindAllAsync(): Promise‹void›
Inherited from Injector.unbindAllAsync
Overrides Injector.unbindAllAsync
Returns: Promise‹void›
unbindAsync
▸ unbindAsync(serviceIdentifier
: interfaces.ServiceIdentifier‹any›): Promise‹void›
Inherited from Injector.unbindAsync
Overrides Injector.unbindAsync
Parameters:
Name | Type |
---|---|
serviceIdentifier | interfaces.ServiceIdentifier‹any› |
Returns: Promise‹void›
unload
▸ unload(...modules
: ContainerModule[]): void
Implementation of Injector
Inherited from Injector.unload
Parameters:
Name | Type |
---|---|
...modules | ContainerModule[] |
Returns: void
Static
merge
▸ merge(container1
: Container, container2
: Container): Container
Parameters:
Name | Type |
---|---|
container1 | Container |
container2 | Container |
Returns: Container