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

Results from `Plushie.Command.async/2` tasks.

## Fields

- `tag` -- the user-defined atom tag from the command
- `result` -- `{:ok, value}` on success, `{:error, reason}` on failure

## Pattern matching

    def update(model, %AsyncEvent{tag: :fetch, result: {:ok, data}}), do: ...
    def update(model, %AsyncEvent{tag: :fetch, result: {:error, reason}}), do: ...

    # Catch all async errors regardless of tag:
    def update(model, %AsyncEvent{result: {:error, reason}}), do: ...

# `t`

```elixir
@type t() :: %Plushie.Event.AsyncEvent{
  result: {:ok, term()} | {:error, term()},
  tag: atom()
}
```

---

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