tricycle / system-actor-model / System.Event

Event Handling


type alias EventHandler appMsg =
System.Internal.Event.EventHandler appMsg

A System Event Handler

default : EventHandler appMsg

Let the System decide what to do

ignore : EventHandler appMsg

Ignore the event

beforeDefault : appMsg -> EventHandler appMsg

Before the default behaviour respond with a custom appMsg

custom : appMsg -> EventHandler appMsg

Ignore the default behaviour and respond with a custom appMsg

Component

Your components can receive Events that are being spawned by the System. It's up to your component to handle these.


type alias ComponentEventHandlers appMsg =
{ onPIDNotFound : System.Internal.PID.PID -> EventHandler appMsg
, onStop : EventHandler appMsg 
}

Components need to supply the following event handlers

systemDefault : ComponentEventHandlers appMsg

You can choose to apply a sytem default behaviour

It might be easy to start with systemDefault when specifying your components event handlers.

{ systemDefault | onStop = beforeDefault SaveProgress }

ignoreAll : ComponentEventHandlers appMsg

You can choose to ignore all events