@arcmantle/adapter-element
    Preparing search index...

    Class PluginContainer

    The main dependency injection container that manages bindings and resolves dependencies. Supports hierarchical container structures, multiple binding types, and module-based organization.

    // Basic usage
    const container = new PluginContainer();
    container.bind('service').class(MyService).singleton();
    const service = container.get<MyService>('service');

    // With parent container
    const child = new PluginContainer({ parent: container });

    // With custom default lifetime
    const transientContainer = new PluginContainer({ defaultLifetime: 'transient' });
    Index

    Constructors

    Properties

    bindings: Map<Identifier, Binding[]>
    defaultLifetime: Lifetimes
    id: string
    moduleIdToIdentifier: Map<string, Identifier[]>
    scopeId: string

    Methods

    • Parameters

      • identifier: Identifier
      • initializer: any
      • resolution: "first" | "last"
      • method: Lifetimes
      • type: "class" | "factory" | "constant"
      • OptionalmoduleId: string

      Returns Binding

    • Starts the binding sequence for an identifier.

      Parameters

      Returns RegisterInitializer

    • Checks if this identifier has already been bound and only binds if it has not.

      Parameters

      Returns undefined | RegisterInitializer

    • Parameters

      • identifier: Identifier
      • resolution: "first" | "last"
      • OptionalmoduleId: string

      Returns RegisterInitializer

    • Returns true or false if this Container has the requested Identifier in itself or any of its parents

      Parameters

      Returns boolean

    • Returns true or false if this Container has the requested Identifier in itself or any of its parents

      Parameters

      Returns boolean

    • Returns true or false if this Container has the requested Identifier in itself or any of its parents

      Parameters

      Returns boolean

    • Returns the first binding matching this identifier.

      Type Parameters

      • T

      Parameters

      Returns T

    • Returns all bindings with this identifier.

      Type Parameters

      • T

      Parameters

      Returns T[]

    • Returns all bindings with this identifier and name combination.

      Type Parameters

      • T

      Parameters

      Returns T[]

    • Returns all bindings with this identifier, name and tagged combination.

      Type Parameters

      • T

      Parameters

      Returns T

    • Parameters

      Returns readonly [undefined | PluginContainer, Binding[]]

    • Returns the last binding for this identifier.

      Type Parameters

      • T

      Parameters

      Returns T

    • Returns the last binding for this identifier and name combination.

      Type Parameters

      • T

      Parameters

      Returns T

    • Returns the last binding for this identifier, name and tag combination.

      Type Parameters

      • T

      Parameters

      Returns T

    • Returns the first binding matching this identifier and name.

      Type Parameters

      • T

      Parameters

      Returns T

    • Returns the first binding matching this identifier, name and tag.

      Type Parameters

      • T

      Parameters

      Returns T

    • Returns true or false if this Container has the requested Identifier

      Parameters

      Returns boolean

    • Returns true or false if this Container has the requested Identifier

      Parameters

      Returns boolean

    • Returns true or false if this Container has the requested Identifier

      Parameters

      Returns boolean

    • Loads all bindings for a module(s)

      Parameters

      Returns void

    • Unbinds all bindings for this identifier and rebinds the new binding.

      Parameters

      Returns RegisterInitializer

    • Parameters

      Returns any

    • Parameters

      Returns any

    • Parameters

      Returns any

    • Returns the value of the binding if it exists, otherwise returns undefined.

      Type Parameters

      • T

      Parameters

      Returns undefined | T

    • Returns all bindings with this identifier or an empty array if it does not exist.

      Type Parameters

      • T

      Parameters

      Returns T[]

    • Unbinds all bindings matching this identifier.

      Parameters

      Returns void

    • Clears all bindings and references held by this container.

      Returns void

    • Unbinds all bindings that were registered from a module(s).

      Parameters

      Returns void