An extension container.

interface IExtensionContainer {
    isInitialized: boolean;
    parent: null | IExtensionContainer;
    createChild(): IExtensionContainer;
    dispose(): void;
    getExtensions<E extends Extension<ExtensionContext>>(
        extensionType: string,
    ): IExtensionInstance<E>[];
    initialize(context: { diContainer: DiContainer }): Promise<void>;
    registerExtension<E extends Extension<ExtensionContext>>(
        params: {
            extension: new (...params: unknown[]) => E;
            extensionName?: string;
            extensionType?: string;
            order?: number;
            singleton?: boolean;
            stage?: ExtensionStage;
            when?:
                | ExtensionRegisterPredicate<E, ExtractExtensionContext<E>>
                | ExtensionRegisterPredicate<E, ExtractExtensionContext<E>>[];
        },
    ): this;
    resolveExecutor<E extends Extension<ExtensionContext>>(
        extension: string | AbstractNewable<E>,
        options?: null | ExtensionExecutorOptions,
    ): IExtensionExecutor<E>;
}

Implemented by

Properties

isInitialized: boolean

Indicates that the container has been initialized. Adding new extensions is not possible.

parent: null | IExtensionContainer

Parent extension container.

Methods

  • Releases all related objects.

    Returns void

  • Initializes the extension container.

    Parameters

    Returns Promise<void>

  • Registers a specific extension in the container.

    Type Parameters

    Parameters

    • params: {
          extension: new (...params: unknown[]) => E;
          extensionName?: string;
          extensionType?: string;
          order?: number;
          singleton?: boolean;
          stage?: ExtensionStage;
          when?:
              | ExtensionRegisterPredicate<E, ExtractExtensionContext<E>>
              | ExtensionRegisterPredicate<E, ExtractExtensionContext<E>>[];
      }

      Registration parameters.

      • extension: new (...params: unknown[]) => E

        The extension that needs to be registered in the container.

      • OptionalextensionName?: string

        Имя регистрируемого расширения.

      • OptionalextensionType?: string

        Тип регистрируемого расширения.

      • Optionalorder?: number

        The order of execution, taking into account the type of extension and the stage of execution.

      • Optionalsingleton?: boolean

        A flag indicating the lifetime of an instance of extensions.

      • Optionalstage?: ExtensionStage

        The stage of the extension execution in the extension chain.

      • Optionalwhen?:
            | ExtensionRegisterPredicate<E, ExtractExtensionContext<E>>
            | ExtensionRegisterPredicate<E, ExtractExtensionContext<E>>[]

        Function or array of functions that accept the context of extension execution and allowing extensions to be performed only under certain conditions. If `true', then the lifetime of the extension instance will coincide with the lifetime of the container.

    Returns this

    The current extension container.

MMNEPVFCICPMFPCPTTAAATR