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

    Interface IComponentFramework

    The component framework allows TypeScript components to communicate using well-defined APIs.

    APIs are TypeScript interfaces that meet certain requirements:

    • It implements IComponentApi and has a unique ["_apiId"] property,
    • It only contains methods that return Promises, of which both the parameters and the return type are serializable values,
    • It can raise events, of which the event args are serializable.
    interface IComponentFramework {
        getApi<TApi extends IComponentApi<{}>>(apiId: TApi["_apiId"]): TApi;
        registerApi<TApi extends IComponentApi<{}>>(
            apiId: TApi["_apiId"],
            componentApi: ContextAwareApi<TApi>,
        ): void;
    }
    Index

    Methods

    • Obtain an implementation of the API with the specified API ID.

      The implementation can either be a "local" object (same web context), or a facade for a remote object (different web context).

      The component framework ensures that method calls and events are propagated to remote objects.

      Type Parameters

      Parameters

      • apiId: TApi["_apiId"]

        The unique identifier of the API.

      Returns TApi

    • Register an API with the component framework. This allows other components to consume this API.

      If this is the singleton host, other remote component frameworks will be able to remotely call this API.

      Type Parameters

      Parameters

      • apiId: TApi["_apiId"]

        The unique identifier of the API.

      • componentApi: ContextAwareApi<TApi>

        An object implementing the API.

      Returns void