xInjection - v2.1.2
    Preparing search index...

    Interface IDynamicModuleDefinition

    interface IDynamicModuleDefinition {
        subscribe: (
            callback: SignalCallback<DefinitionEvent>,
            invokeImmediately?: boolean,
        ) => () => void;
        addImport(
            moduleOrBlueprint: ModuleOrBlueprint,
            addToExports?: boolean,
        ): void;
        addImportLazy(
            lazyCb: AsyncMethod<IProviderModule>,
            addToExports?: boolean,
        ): Promise<void>;
        addProvider<T>(
            provider: DependencyProvider<T>,
            addToExports?: boolean,
        ): void;
        addProviderLazy<T>(
            lazyCb: AsyncMethod<DependencyProvider<T>>,
            addToExports?: boolean,
        ): Promise<void>;
        removeFromExports(exportDefinition: ExportDefinition): boolean;
        removeImport(moduleOrId: IProviderModule | ModuleIdentifier): boolean;
        removeProvider<T>(
            providerOrIdentifier:
                | string
                | symbol
                | Function
                | Class<T>
                | ProviderClassToken<T>
                | ProviderValueToken<T>
                | ProviderFactoryToken<T>,
        ): boolean;
    }

    Implemented by

    Index

    Properties

    subscribe: (
        callback: SignalCallback<DefinitionEvent>,
        invokeImmediately?: boolean,
    ) => () => void

    Can be used to subscribe in real-time to the definition changes.

    Type declaration

      • (
            callback: SignalCallback<DefinitionEvent>,
            invokeImmediately?: boolean,
        ): () => void
      • Can be used to subscribe to the emitted values of this Signal.

        Parameters

        • callback: SignalCallback<DefinitionEvent>

          The callback which will be invoked when a new value is emitted.

        • OptionalinvokeImmediately: boolean

          When set to true it'll invoke the provided callback immediately with the latest value available. (defaults to false)

        Returns () => void

    Methods

    • Can be used to lazily import a new module into the current Module.

      Note: This is useful when you want to lazy import a module from within another file.

      addImportLazy(async () => import('./lazy.module'));
      

      Parameters

      • lazyCb: AsyncMethod<IProviderModule>

        An async callback which will resolve the Module to be imported.

      • OptionaladdToExports: boolean

        When set to true it'll also export the module. (defaults to false)

      Returns Promise<void>

    • Can be used to lazily bind a new provider to the Module's container.

      Note: This is useful when you want to lazy import a provider from within another file.

      addImportLazy(async () => import('./lazy.provider'));
      

      Type Parameters

      • T

      Parameters

      • lazyCb: AsyncMethod<DependencyProvider<T>>

        An async callback which will resolve the Provider to add.

      • OptionaladdToExports: boolean

        When set to true it'll also export the module. (defaults to false)

      Returns Promise<void>