Options
All
  • Public
  • Public/Protected
  • All
Menu

An IoC container that uses constructor dependency injection to create container components and to resolve dependencies. This container defines the entry and exit points for any Coaty application providing lifecycle management for its components.

Hierarchy

  • Container

Index

Constructors

constructor

Accessors

communicationManager

identity

  • Gets the identity object of this container.

    The identity can be initialized in the common configuration option agentIdentity.

    Returns Readonly<Identity>

runtime

Methods

getController

  • getController<T>(controllerName: string): T
  • Gets the registered controller of the given controller name. Returns undefined if a controller with the given name is not registered in Components.

    Type parameters

    • T: IController

    Parameters

    • controllerName: string

      the name of the controller specified as Components key for the controller

    Returns T

mapControllers

  • mapControllers<T>(callback: (controllerName: string, controllerType: IControllerStatic<IController>, controller: IController) => T): T[]
  • Creates a new array with the results of calling the provided callback function once for each registered controller name/controllerType/controller instance triple.

    Type parameters

    • T

    Parameters

    • callback: (controllerName: string, controllerType: IControllerStatic<IController>, controller: IController) => T

      function that returns an element of the new array

        • (controllerName: string, controllerType: IControllerStatic<IController>, controller: IController): T
        • Parameters

          • controllerName: string
          • controllerType: IControllerStatic<IController>
          • controller: IController

          Returns T

    Returns T[]

registerController

  • registerController<T>(controllerName: string, controllerType: IControllerStatic<T>, controllerOptions?: ControllerOptions): T
  • Dynamically registers and resolves the given controller type with the specified controller options. The request is silently ignored if the container has already been shut down.

    Type parameters

    • T: IController

    Parameters

    • controllerName: string

      the name to be registered with the controller

    • controllerType: IControllerStatic<T>

      the class type of the controller

    • Optional controllerOptions: ControllerOptions

      the controller's configuration options (optional)

    Returns T

    the resolved controller instance or undefined if a controller could not be resolved

shutdown

  • shutdown(): void
  • The exit point for a Coaty applicaton. Releases all registered container components and its associated system resources. This container should no longer be used afterwards.

    Returns void

Static resolve

Static resolveAsync

  • Asynchronously creates and bootstraps a Coaty container by registering and resolving the given components and configuration options. Use this method if configuration should be retrieved asnychronously (e.g. via HTTP) by one of the predefined runtime configuration providers (see runtime-angular, runtime-node). The promise returned will be rejected if the configuration could not be retrieved or has a falsy value.

    Parameters

    Returns Promise<Container>

    a promise on a Container for the given components

Generated using TypeDoc