Adds an event listener for receiving specific types of messages.
The message type to listen for.
The callback function to execute when a message is received.
Removes all registered listeners. Subclasses override this to perform additional cleanup.
Instance key (used by subclass overrides for registry cleanup).
Dispatches an event to all listeners of a specific message type.
The message type.
The data associated with the event.
Removes an event listener for a specific type of message.
The message type.
The callback function to remove.
EventDispatcher is a class that manages event listeners and dispatches events to them.
What does it unlock?
Parent class of Communicator that dispatches commands. Acts as an event dispatcher that routes command messages internally.
Practical Application
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.
AI Coding Best Practices
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.