SC.Event (sc v1.0.2)

View Source

Represents an event that can be sent to a state chart.

Events can be external (from outside the state chart) or internal (generated by the state chart itself, e.g., from <raise> actions).

Summary

Functions

Check if an event is external.

Create a new internal event.

Check if an event is internal.

Check if this event matches a transition's event specification.

Create a new external event.

Types

origin()

@type origin() :: :external | :internal

t()

@type t() :: %SC.Event{data: map(), name: String.t(), origin: origin()}

Functions

external?(event)

@spec external?(t()) :: boolean()

Check if an event is external.

internal(name, data \\ %{})

@spec internal(String.t(), map()) :: t()

Create a new internal event.

internal?(event)

@spec internal?(t()) :: boolean()

Check if an event is internal.

matches?(event, event_spec)

@spec matches?(t(), String.t() | nil) :: boolean()

Check if this event matches a transition's event specification.

For now, only supports exact string matching.

new(name, data \\ %{})

@spec new(String.t(), map()) :: t()

Create a new external event.