System events are sent to a component's onSystem function.
onSystem : SystemEvent -> SystemEvent.Handling MsgIn
onSystem event =
case event of
PIDNotFound pid ->
UnObserveData pid
|> SystemEvent.iWillHandleIt
Kill ->
SystemEvent.defaultThis gives you the choice of how to handle them by returning Handling.
If you don't care you can just set the handling to default in your component's record.
component =
{ init = init
, onSystem = always SystemEvent.default
...
}If your component sends a message to a PID that does not exist
anymore you will receive a PIDNotFound event containing the PID of the
killed process.
This lets you clean up any PID's you stored in your model for example.
Default handling for this event is to do nothing.
Kill is received when your component is going to be killed. You have the chance to say some last words before dying.
Default handling for Kill is to also kill all the children of the process.
How should events be handeled.
Use event default handling.
Don't do anyting.
Handle it yourself.
Map the Handling type.
System Event