class
EventDispatcher
- Module
- Events
- Header
#include "Events/EventDispatcher.h"- Namespace
Mowo
Type aliases
| Alias | Description |
|---|---|
using EventCallback = std::function<void(Event&)> |
Public functions
| Returns | Name | Description |
|---|---|---|
uint64_t | Subscribe | |
bool | Unsubscribe | A listener removed from inside its own dispatch is nulled in place and compacted after the walk — erasing mid-iteration invalidated the loop. |
void | Dispatch | |
bool | Dispatch | Type-filtered dispatch: runs func only when the event is a T. |
void | Clear | Clearing from inside a handler must not free the vector the dispatch walk is iterating — null the callbacks instead; the walk skips them and compacts its own type's vector afterwards. |
void | Clear | Clear listeners for a specific event type |
Function details
Subscribe
C++
template<typename T> uint64_t Subscribe(std::function<void(T&)> callback)Unsubscribe
C++
bool Unsubscribe(uint32_t typeID, uint64_t id)A listener removed from inside its own dispatch is nulled in place and compacted after the walk — erasing mid-iteration invalidated the loop.
Dispatch
C++
void Dispatch(Event& event)Dispatch
C++
template<typename T, typename F> bool Dispatch(Event& event, F&& func)Type-filtered dispatch: runs func only when the event is a T.
Clear
C++
void Clear()Clearing from inside a handler must not free the vector the dispatch walk is iterating — null the callbacks instead; the walk skips them and compacts its own type's vector afterwards.
Clear
C++
template<typename T> void Clear()Clear listeners for a specific event type
Generated from Events/EventDispatcher.h via events.json · Oct 26, 2026Version 1.0.0