Documentation
ΒΆ
Index ΒΆ
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func Get ΒΆ
func Get[T any]() (module T)
Get returns the registered service associated with the given interface.
func GetAfterRegister ΒΆ
func GetAfterRegister[T any](fn func(module T))
GetAfterRegister is a special case for the init function, the callback is triggered after the service is registered. If the service has already been registered for the given interface, the callback is executed with the registered service as a parameter. If the service has not yet been registered, the callback is added to the list of registered callbacks for this interface.
func Register ΒΆ
func Register[T any](module T)
Register a service associated with the given interface. If a service is already registered for this interface, the function does nothing. If callbacks have been registered for this interface, they are executed with the registered service as a parameter.
Types ΒΆ
type Service ΒΆ
func (*Service) GetCallbacksByIdentifier ΒΆ
GetCallbacksByIdentifier : This function returns the list of registered callbacks associated with the given identifier. If no callback is associated with this identifier, the function returns an empty list
func (*Service) GetServiceByIdentifier ΒΆ
GetServiceByIdentifier : This function returns the registered service associated with the given identifier. If no service is associated with this identifier, the function returns nil.
func (*Service) SetCallbacksByIdentifier ΒΆ
SetCallbacksByIdentifier : This function adds a callback to the list of registered callbacks associated with the given identifier.
func (*Service) SetServiceByIdentifier ΒΆ
SetServiceByIdentifier : This function registers a service associated with the given identifier.