View Source Ecspanse.Template.Event (ECSpanse v0.10.0)
A template event is a generic way of defining the structure for related events that share the same fields.
The template event guarantees that the event that uses it will have certain fields. The event itself can define additional fields, specific to its implementation.
The framework embeds some predefined event templates:
Ecspanse.Template.Event.Timer
- an event template that is used to create timer events
Options
See Ecspanse.Event
for the list of options.
Examples
defmodule Demo.Events.ConsumerResource do
use Ecspanse.Template.Event, fields: [:amount]
end
defmodule Demo.Events.ConsumerGold do
use Demo.Events.ConsumeResource, fields: [:amount, :hero_entity_id]
end