Hosanna UI API v1.30.2-next
    Preparing search index...

    IoCContainer is responsible for managing service registration and resolution. It supports dependency injection and lazy initialization of services.

    Index

    Constructors

    • Initializes a new instance of the IoCContainer class. Loads the provided service map and registers it globally.

      Parameters

      • serviceMap: IOCServiceMap

        The service map defining how services are registered and resolved.

      Returns IoCContainer

    Properties

    __hs_global: any

    A global platform-specific object, decorated with @platformGlobal.

    serviceMap: Record<string, IOCServiceMapItem> = {}

    A record of service map items, keyed by their unique identifiers.

    services: Record<string, any> = {}

    A record of registered services, keyed by their unique identifiers.

    Methods

    • Creates a service instance from the service map.

      Parameters

      • key: string

        The unique key identifying the service.

      Returns any

      The created service instance.

      Error if the service cannot be created.

    • Loads the service map and registers its items.

      Parameters

      Returns void

    • Registers a service with the specified key.

      Parameters

      • key: string

        The unique key identifying the service.

      • service: any

        The service instance to register.

      Returns void

    • Resolves a service by its key. If the service is not found, it attempts to create it from the service map.

      Type Parameters

      • T

      Parameters

      • key: string

        The unique key identifying the service.

      Returns T

      The resolved service instance.

      Error if the service cannot be found or created.