@epikodelabs/streamix / src/public-api / Container
Interface: Container
Defined in: projects/libraries/streamix/src/lib/ioc/container.ts:95
Functional IoC container.
The container is created by a factory function and exposes a functional API. Internal state (registrations, caches, disposal order) is held in closures and WeakMaps so it cannot be accessed from outside.
Properties
_tag
readonly_tag:"Container"
Defined in: projects/libraries/streamix/src/lib/ioc/container.ts:96
parent
readonlyparent:Container|null
Defined in: projects/libraries/streamix/src/lib/ioc/container.ts:97
Methods
register()
register<
T>(token,factory,options?):Container
Defined in: projects/libraries/streamix/src/lib/ioc/container.ts:104
Registers a service with the container.
Returns the same container for fluent chaining.
Type Parameters
T
T
Parameters
token
Token<T>
factory
Factory<T>
options?
Returns
Container
resolve()
resolve<
T>(token,scope?):T
Defined in: projects/libraries/streamix/src/lib/ioc/container.ts:113
Resolves a required service. Throws if the token is not registered.
Type Parameters
T
T
Parameters
token
Token<T>
scope?
Scope<Record<string, any>> | null
Returns
T
resolveOptional()
resolveOptional<
T>(token,scope?):T|undefined
Defined in: projects/libraries/streamix/src/lib/ioc/container.ts:118
Resolves an optional service. Returns undefined if not registered.
Type Parameters
T
T
Parameters
token
Token<T>
scope?
Scope<Record<string, any>> | null
Returns
T | undefined
has()
has<
T>(token):boolean
Defined in: projects/libraries/streamix/src/lib/ioc/container.ts:123
Checks whether the token is registered in this container or any parent.
Type Parameters
T
T
Parameters
token
Token<T>
Returns
boolean
createChild()
createChild():
Container
Defined in: projects/libraries/streamix/src/lib/ioc/container.ts:128
Creates a child container that inherits registrations from this one.
Returns
Container
dispose()
dispose():
Promise<void>
Defined in: projects/libraries/streamix/src/lib/ioc/container.ts:134
Disposes the container and runs cleanup for all owned singleton/scoped instances in reverse resolution order.
Returns
Promise<void>