abstract class Pulsar::Event

Defined in:

pulsar/event.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.subscribe(&block : self -> Nil) #

Subscribe to events

MyEvent.subscribe do |event|
  puts event.name # "MyEvent"
end

MyEvent.new.publish # Will run the block above

[View source]

Instance Method Detail

def name #

Returns the name of the event.

The event name is the name of the class. So an class of MyShard::MyEvent would return "MyShard::MyEvent".


[View source]
def publish #

Publishes the event to all subscribers.

MyEvent.new.publish

[View source]
def started_at #

When the event started


[View source]