The service map extending ServiceMap
Jimple
Create a Jimple Container.
Optional
values: Partial<InitialServiceMap<TMap, JimpleWithProxy<TMap>>>Initial services and parameters to register
Extends a service already registered in the container. Allows decorating or modifying an existing service definition.
The service key type
The extended service type
The service key to extend
Function that receives the original service and returns the extended version
Defines a service as a factory that creates new instances on every access. Unlike regular services (which are singletons), factories always call the function.
The service key type
The factory function type
The factory function to mark
The same function (for chaining)
Return the specified parameter or service with correct typing. Services defined as functions are instantiated when first accessed (singleton pattern). Services marked as factories are instantiated on every access. Services marked as protected are returned as-is without being called.
The service key type
The service key to retrieve
The service instance or parameter value
Returns if a service or parameter is defined in the container.
The service key type
The service key to check
True if the service is defined
Returns the raw value of a service or parameter without instantiation. For services defined as functions, returns the function itself rather than calling it.
The service key type
The service key
The raw service definition or parameter value
Uses a provider to extend the service container. Providers are objects with a register method that can add multiple services.
The subset of service keys the provider manages
The service provider to register
Defines a new parameter or service. Functions are treated as service factories unless marked as protected.
The service key type
The service key
The service value, instance, or factory function
Unsets a parameter or service, removing it from the container. Also clears any cached instances and metadata for the service.
The service key type
The service key to remove
Static
createCreates a new Jimple container instance with proxy support.
The service map
Optional
values: Partial<InitialServiceMap<TMap, JimpleWithProxy<TMap>>>Initial services and parameters to register
A proxy-enhanced container
Static
providerCreates a service provider object.
The service map
Function that registers services with a container
Registers services with the provided container.
The container to register services with
A service provider object
The Jimple Container class with TypeScript support. A dependency injection container that manages services and parameters.
Example