Pulsar::Event
Inherits Pulsar::BaseEvent < Reference < Object
Class methods
publish(*args_, **named_args_)
Publishes the event to all subscribers.
MyEvent.publish
Passing arguments to initialize
If your event defines an initialize and requires arguments, you can
pass those arguments to publish.
For example if you had the event:
class MyEvent < Pulsar::Event
def initialize(custom_argument : String)
end
end
You would pass the arguments to publish and they will be used to
initialize the event:
MyEvent.publish(custom_argument: "This is my custom event argument")
subscribe
Subscribe to events
MyEvent.subscribe do |event|
puts event.name # "MyEvent"
end
MyEvent.publish # Will run the block above
Instance methods
started_at
When the event started