Options
All
  • Public
  • Public/Protected
  • All
Menu

yadi

Index

Type aliases

ContainerOptions

ContainerOptions: { resolveChildren: boolean; resolveParent: boolean }

Options for Container

Type declaration

  • resolveChildren: boolean

    If the container cant resolve a dependency and it has children, should it check them in order until it finds one?

  • resolveParent: boolean

    If the container cant resolve a dependency and it has a parent, should it check the parent?

Filter

Filter: { arrayMaxSize?: number; subName?: string; tags?: string[] }

Used by Namespace.resolve to filter implementations

Type declaration

  • Optional arrayMaxSize?: number

    If used with array: true with Namespace.resolve or Container.resolve, will limit the amount the array provides

  • Optional subName?: string

    Filter by subName

  • Optional tags?: string[]

    Filter by tags

NamespaceUnion

NamespaceUnion: Namespace | CustomNamespace

An union that specifies Namespace and CustomNamespace

Functions

afterConstruct

  • afterConstruct(): PropertyDecorator

bindLazyInject

  • bindLazyInject(container: Container): (name?: string, namespace?: string, filter?: Filter, cache?: boolean) => PropertyDecorator
  • Utility method to bind lazy inject to a container

    Parameters

    • container: Container

      The container to use

    Returns (name?: string, namespace?: string, filter?: Filter, cache?: boolean) => PropertyDecorator

      • (name?: string, namespace?: string, filter?: Filter, cache?: boolean): PropertyDecorator
      • Parameters

        • Optional name: string
        • Optional namespace: string
        • Optional filter: Filter
        • Optional cache: boolean

        Returns PropertyDecorator

inject

  • inject(name?: string, namespace?: string, filter?: Filter, array?: boolean): PropertyDecorator & ParameterDecorator
  • A decorator to add an injection entry. Can be used on parameters or properties

    Parameters

    • Optional name: string

      The dependency name

    • Optional namespace: string

      The namespace

    • Optional filter: Filter

      Filter property

    • Optional array: boolean

      Inject arrays

    Returns PropertyDecorator & ParameterDecorator

lazyInject

  • lazyInject(container: Container, name?: string, namespace?: string, filter?: Filter, array?: boolean, cache?: boolean): PropertyDecorator
  • A decorator that injects a dependency lazily using container. Mostly used for classes where you can't control the creation of it. Can only be used on properties

    Parameters

    • container: Container

      The container to use

    • Optional name: string

      The dependency name

    • Optional namespace: string

      The namespace

    • Optional filter: Filter

      Filter object

    • Optional array: boolean

      Inject arrays

    • cache: boolean = true

      Cache return values, can be invalidated by setting the property to undefined

    Returns PropertyDecorator