module Onyx::EDA::Event

Overview

A basic event module to include.

According to Wikipedia:

a significant temporal state or fact

Code example:

struct MyEvent
  include Onyx::EDA::Event

  getter foo

  def initialize(@foo : String)
  end
end

channel.subscribe(MyEvent) do |event|
  puts event.foo
end

event = channel.emit(MyEvent.new)
pp event.event_id # => <UUID>

sleep # You need to yield the control, see more in Channel docs

Defined in:

onyx-eda/event.cr
onyx-eda/channel/redis.cr

Instance Method Summary

Instance Method Detail

def event_id : UUID #

This event ID. Defaults to a random UUID.


[View source]