@mendix/extensions-api - v0.5.0
    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 {
        addApiProcessor<TApi extends RemoteableComponentApi<TApi>>(
            apiProcessor: (api: TApi) => Promise<void>,
        ): void;
        getApi<TApi extends IComponentApi<{}>>(apiId: ApiId<TApi>): TApi;
        registerApi<TApi extends RemoteableComponentApi<TApi>>(
            apiId: ApiId<TApi>,
            componentApi: ContextAwareApi<TApi>,
        ): void;
    }
    Index

    Methods

    • Register an API processor with the component framework. This allows different components to collect information about APIs as they are registered. NB: This works only for main component host and will process information only about APIs registered in the main host.

      Type Parameters

      • TApi extends RemoteableComponentApi<TApi>

      Parameters

      • apiProcessor: (api: TApi) => Promise<void>

        A function that processes the API call.

      Returns void

    • 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: ApiId<TApi>

        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

      • TApi extends RemoteableComponentApi<TApi>

      Parameters

      • apiId: ApiId<TApi>

        The unique identifier of the API.

      • componentApi: ContextAwareApi<TApi>

        An object implementing the API.

      Returns void