Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DiContainer

Dependency injection container.

Hierarchy

  • DiContainer

Index

Constructors

constructor

Accessors

parent

  • Parent container. By default, if container has no own value it looks to the parents.

    Returns DiContainer

  • Parent container. By default, if container has no own value it looks to the parents.

    Parameters

    Returns void

timestamp

  • get timestamp(): number
  • Value, indicating last change of the current container and its parents.

    Returns number

Methods

dispose

  • dispose(): void
  • Releases all records and removes itself from parent container.

    Returns void

getRecord

  • getRecord<KeyT, ValueT>(key: KeyT, allowParentLookup?: boolean): DiRecord<KeyT, ValueT>
  • Get registered DiRecord for specified key.

    Type parameters

    • KeyT

    • ValueT

    Parameters

    • key: KeyT

      Key of the record

    • Default value allowParentLookup: boolean = true

      Should conainer look up to the parents, if no own record found.

    Returns DiRecord<KeyT, ValueT>

register

  • register<KeyT, ValueT>(key: KeyT, value: ValueT): DiRecord<KeyT, ValueT>
  • Register or update value for specified key.

    Type parameters

    • KeyT

    • ValueT

    Parameters

    • key: KeyT

      Key to identify value in container.

    • value: ValueT

      Value to inject.

    Returns DiRecord<KeyT, ValueT>

    Created or existing DiRecord

unregister

  • unregister<KeyT>(key: KeyT, checkParents?: boolean): boolean
  • Removes recored from the container.

    Type parameters

    • KeyT

    Parameters

    • key: KeyT

      Record key to remove.

    • Default value checkParents: boolean = false

      Should remove from parent containers as well.

    Returns boolean

    Did any record found (and removed) or not.

unregisterAll

  • unregisterAll(): void
  • Remove all records from current container (parent containers are not touched).

    Returns void

Generated using TypeDoc