PointClickEngine::Core::Events::EventBus
Inherits Reference < Object
Central event bus for the entire engine
Example usage:
bus = EventBus.new
# Subscribe to specific event type
bus.subscribe(PlayerMovedEvent) do |event|
puts "Player moved to #{event.position}"
end
# Publish an event
bus.publish(PlayerMovedEvent.new(position, old_position))
# Process queued events
bus.process
Instance methods
has_handlers?(event_class : T.class) : Bool forall T
Check if any handlers exist for an event type
subscribe(event_class : T.class, priority : HandlerPriority = HandlerPriority::Normal, owner : String | Nil = nil, &handler : T -> Nil) : UInt64 forall T
Subscribe to a specific event type with a typed handler
Returns a subscription ID that can be used to unsubscribe
subscribe(event_class : T.class, priority : Int32, owner : String | Nil = nil, &handler : T -> Nil) : UInt64 forall T
Subscribe with explicit priority value
unsubscribe_all_for(event_class : T.class) forall T
Unsubscribe all handlers for a specific event type