@3dsource/metabox-front-api
    Preparing search index...

    Class CommunicatorInternal

    Handles messaging between the host page and embedded Metabox content.

    Internal class that creates a proxy/communication layer between the API and MetaBox. Handles reading and sending commands through the established connection.

    The API handle returned in the integrateMetabox callback. Provides sendCommandToMetabox() to send commands, and addEventListener()/removeEventListener() for event subscriptions. This is your entire interface to the MetaBox Unreal Engine stream.

    Store the Communicator reference from the apiReadyCallback in a module-scoped variable or state store. NEVER send commands before this callback fires. All commands and event listeners go through this single api object. Clean up listeners with removeEventListener on component unmount.

    Use Communicator.createInstance or the integrateMetabox helper to instantiate.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    listeners: Listener[] = []

    Storage for callback listeners by message type.

    instance: Communicator | null = null

    Singleton reference to the current communicator instance.

    Methods

    • Cleans up resources and stops listening for messages.

      Parameters

      • key: string

      Returns void

    • Posts a command to the Metabox iframe.

      Type Parameters

      • T extends CommandBase

      Parameters

      • command: T

        An action command containing data to send.

      Returns void

    • Destroys all active Communicator instances and clears the internal registry.

      Returns void

    • Listens for Metabox to signal readiness, then initializes communicator.

      Parameters

      • apiReadyCallback: (api: Communicator) => void

        Called with the new Communicator once the Metabox is loaded.

      • environment: MetaboxEnvironment

        The environment in which the Communicator is running.

      • Optionalconfig: Partial<MetaboxCommandConfig>

        optional initial config: standalone - if true - disable metabox custom template and all logic

      Returns void

    • Retrieves a registered Communicator instance by its key.

      Parameters

      • key: string

        The composite key (version_environment_appId) identifying the instance.

      Returns { instance: Communicator } | undefined