Options
All
  • Public
  • Public/Protected
  • All
Menu

Service container.

Hierarchy

  • Container

Index

Properties

Static Private globalInstance

globalInstance: ContainerInstance = new ContainerInstance(undefined)

Global container instance.

Static handlers

handlers: Handler[] = []

All registered handlers.

Static Private instances

instances: ContainerInstance[] = []

Other containers created using Container.of method.

Methods

Static get

  • get<T>(type: ObjectType<T>): T
  • get<T>(id: string): T
  • get<T>(id: Token<T>): T
  • Retrieves the service with given name or type from the service container. Optionally, parameters can be passed in case if instance is initialized in the container for the first time.

    Type parameters

    • T

    Parameters

    Returns T

  • Retrieves the service with given name or type from the service container. Optionally, parameters can be passed in case if instance is initialized in the container for the first time.

    Type parameters

    • T

    Parameters

    • id: string

    Returns T

  • Retrieves the service with given name or type from the service container. Optionally, parameters can be passed in case if instance is initialized in the container for the first time.

    Type parameters

    • T

    Parameters

    Returns T

Static getMany

  • getMany<T>(id: string): T[]
  • getMany<T>(id: Token<T>): T[]
  • Gets all instances registered in the container of the given service identifier. Used when service defined with multiple: true flag.

    Type parameters

    • T

    Parameters

    • id: string

    Returns T[]

  • Gets all instances registered in the container of the given service identifier. Used when service defined with multiple: true flag.

    Type parameters

    • T

    Parameters

    Returns T[]

Static has

  • has<T>(type: ObjectType<T>): boolean
  • has<T>(id: string): boolean
  • has<T>(id: Token<T>): boolean
  • Checks if the service with given name or type is registered service container. Optionally, parameters can be passed in case if instance is initialized in the container for the first time.

    Type parameters

    • T

    Parameters

    Returns boolean

  • Checks if the service with given name or type is registered service container. Optionally, parameters can be passed in case if instance is initialized in the container for the first time.

    Type parameters

    • T

    Parameters

    • id: string

    Returns boolean

  • Checks if the service with given name or type is registered service container. Optionally, parameters can be passed in case if instance is initialized in the container for the first time.

    Type parameters

    • T

    Parameters

    Returns boolean

Static import

Static of

Static registerHandler

Static remove

Static reset

  • Completely resets the container by removing all previously registered services and handlers from it.

    Parameters

    • Optional containerId: any

    Returns Container

Static set

Generated using TypeDoc