# `Plushie.Event.SystemEvent`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.7.2/lib/plushie/event/system_event.ex#L1)

System query responses and platform events.

Covers responses to system queries (`system_info`, `system_theme`)
as well as recurring platform events like animation frames and OS theme
changes.

## Fields

  * `type` - `:system_info`, `:system_theme`, `:animation_frame`,
    `:theme_changed`, `:all_windows_closed`, `:image_list`,
    `:tree_hash`, `:find_focused`, `:diagnostic`, `:recovery_failed`,
    `:announce`, or `:error`
  * `tag` - caller-supplied correlation tag from the originating query;
    for diagnostics, the diagnostic code
  * `value` - payload; shape depends on event type
  * `id` - originating widget/canvas ID (diagnostics only)
  * `window_id` - originating window ID (diagnostics only)

## Pattern matching

    def update(model, %SystemEvent{type: :system_info, value: %{"os" => os}}) do
      %{model | platform: os}
    end

    def update(model, %SystemEvent{type: :theme_changed, value: theme}) do
      %{model | theme: theme}
    end

    def update(model, %SystemEvent{type: :animation_frame, value: ts}) do
      advance_animation(model, ts)
    end

# `delivered_t`

```elixir
@type delivered_t() :: t()
```

System event delivered by the renderer.

# `t`

```elixir
@type t() :: %Plushie.Event.SystemEvent{
  id: String.t() | nil,
  tag: String.t() | nil,
  type:
    :system_info
    | :system_theme
    | :animation_frame
    | :theme_changed
    | :all_windows_closed
    | :image_list
    | :tree_hash
    | :find_focused
    | :announce
    | :diagnostic
    | :recovery_failed
    | :error,
  value: map() | String.t() | number() | nil,
  window_id: String.t() | nil
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
