Typed event definitions for Dala plugins.
Provides a type-safe event system with compile-time field validation and efficient binary encoding for the native bridge.
Defining Events
Events are defined inside component blocks:
component "chart" do
event :zoom, %{x: :f32, y: :f32}
event :pan, %{x: :f32, y: :f32}
endThis generates a struct module at YourPlugin.Chart.Events.Zoom with
typed fields and validation.
Event Struct
The generated struct contains:
- Fields declared in the event definition
__event_name__/0— returns the event atom__event_fields__/0— returns list of field names__event_types__/0— returns map of field name to type
Encoding
Events are encoded as binary for the native bridge using opcode 0xF2.
Summary
Functions
Returns the fully-qualified module name for an event struct.
Creates the AST for an event struct module definition.
Returns the event name as a string.
Creates a new event definition.
Types
Functions
Returns the fully-qualified module name for an event struct.
Creates the AST for an event struct module definition.
This is meant to be called at compile time inside a __before_compile__ callback.
Returns the event name as a string.
Creates a new event definition.