@mendix/extensions-api - v0.9.0
    Preparing search index...

    Interface IModuleApi

    API for working with modules.

    interface IModuleApi {
        _apiId: "mendix.ModuleApi";
        addEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): DisposeListener;
        addModule(name: string): Promise<Readonly<Module>>;
        deleteModule(name: string, allowNonEmptyDeletion?: boolean): Promise<void>;
        getModule(name: string): Promise<null | Readonly<Module>>;
        getModules(): Promise<readonly Readonly<Module>[]>;
        removeEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    _apiId: "mendix.ModuleApi"

    Unique identifier that can be used to register or retrieve a specific API.

    Example: mendix.EditorsAPI, mycompany.MyFunkyAPI

    Methods

    • Adds an event listener for the specified event type.

      Type Parameters

      • K extends never

      Parameters

      • eventType: K

        The type of event to listen for.

      • listener: EventHandler<{}, K>

        The event listener to add.

      Returns DisposeListener

      A function that can be called to remove the event listener.

    • Creates a new module.

      Parameters

      • name: string

        The name of the new module.

      Returns Promise<Readonly<Module>>

      Promise resolving to the created module.

    • Deletes a module by its name.

      Parameters

      • name: string

        The name of the module to delete.

      • OptionalallowNonEmptyDeletion: boolean

        Flag indicating whether to force deletion of non-empty modules.

      Returns Promise<void>

      Promise that resolves when the module is deleted.

    • Retrieves a specific module by its name.

      Parameters

      • name: string

        The name of the module to retrieve.

      Returns Promise<null | Readonly<Module>>

      Promise resolving to the module if found, or null otherwise.

    • Retrieves all modules in the model.

      Returns Promise<readonly Readonly<Module>[]>

      Promise resolving to a readonly array of modules.

    • Removes an event listener for the specified event type.

      Type Parameters

      • K extends never

      Parameters

      • eventType: K

        The type of event to remove the listener from.

      • listener: EventHandler<{}, K>

        The event listener to remove.

      Returns void