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

    Class EventDispatcher

    EventDispatcher is a class that manages event listeners and dispatches events to them.

    Parent class of Communicator that dispatches commands. Acts as an event dispatcher that routes command messages internally.

    Internal event routing layer — parent class of Communicator. Routes postMessage commands between your app and the Unreal Engine pixel stream. Not used directly but understanding it helps debug message delivery issues.

    Do not reference or extend EventDispatcher in application code. Use only the Communicator interface methods. If debugging communication failures, check browser console for postMessage errors related to this layer.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    listeners: Listener[] = []

    Storage for callback listeners by message type.

    Methods

    • Adds an event listener for receiving specific types of messages.

      Parameters

      • messageType: string

        The message type to listen for.

      • callback: (data: unknown) => void

        The callback function to execute when a message is received.

      Returns this

    • Removes all registered listeners. Subclasses override this to perform additional cleanup.

      Parameters

      • key: string

        Instance key (used by subclass overrides for registry cleanup).

      Returns void

    • Dispatches an event to all listeners of a specific message type.

      Parameters

      • messageType: string

        The message type.

      • data: unknown

        The data associated with the event.

      Returns this

    • Removes an event listener for a specific type of message.

      Parameters

      • messageType: string

        The message type.

      • callback: (data: unknown) => void

        The callback function to remove.

      Returns this