34 void subscribe(
const std::string type,
const std::function<
void(
const Event &)> observer);
78 std::map<std::string, std::vector<std::function<void(
const Event &)>>> _observers;
79 std::vector<std::function<void(
const Event &)>> _globalObservers;
80 std::vector<Event> _queue;
A class for managing events.
Definition: Dispatcher.hpp:18
void subscribe(const std::string type, const std::function< void(const Event &)> observer)
Subscribe a specific listener to a specific event type.
void dispatch(const Event &event)
Dispatches an event.
Dispatcher()=default
Construct a new Dispatcher object.
void subscribeGlobal(const std::function< void(const Event &)> observer)
Subscribe a specific listener to all event types.
void queue(const Event &event)
Queues an event to be dispatched later.
void flush()
Dispatches all queued events.
A class representing an event that has occurred.
Definition: Event.hpp:10