Options
All
  • Public
  • Public/Protected
  • All
Menu

TypeDI can have multiple containers. One container is ContainerInstance.

Hierarchy

  • ContainerInstance

Index

Constructors

constructor

Properties

id

id: any

Container instance id.

Private services

services: ServiceMetadata<any, any>[] = []

All registered services.

Methods

Private applyPropertyHandlers

  • applyPropertyHandlers(target: Function, instance: object): void
  • Applies all registered handlers on a given target class.

    Parameters

    • target: Function
    • instance: object
      • [key: string]: any

    Returns void

Private filterServices

Private findService

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

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[]

Private getServiceValue

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

Private initializeParams

  • initializeParams(type: Function, paramTypes: any[]): any[]
  • Initializes all parameter types for a given target service class.

    Parameters

    • type: Function
    • paramTypes: any[]

    Returns any[]

Private isTypePrimitive

  • isTypePrimitive(param: string): boolean

remove

reset

  • reset(): this

set

  • set<T, K>(service: ServiceMetadata<T, K>): this
  • set(type: Function, value: any): this
  • set(name: string, value: any): this
  • set(token: Token<any>, value: any): this
  • set(token: ServiceIdentifier, value: any): this
  • set<T, K>(values: ServiceMetadata<T, K>[]): this

Generated using TypeDoc