# `ExRatatui.Subscription`
[🔗](https://github.com/mcass19/ex_ratatui/blob/v0.7.1/lib/ex_ratatui/subscription.ex#L1)

Subscriptions represent ongoing or delayed self-messages owned by an app.

The server reconciles subscriptions after each state transition, diffing by
stable `id` so applications can declare timers without manually managing
`Process.send_after/3` references.

Available subscription constructors:

  * `interval/3` — repeated self-message at a fixed interval
  * `once/3` — one-shot self-message delivered once after a delay

Reducer apps declare subscriptions by implementing `subscriptions/1`.

# `kind`

```elixir
@type kind() :: :interval | :once
```

# `t`

```elixir
@type t() :: %ExRatatui.Subscription{
  id: term(),
  interval_ms: pos_integer(),
  kind: kind(),
  message: term()
}
```

# `interval`

```elixir
@spec interval(term(), pos_integer(), term()) :: t()
```

Declares a repeating self-message subscription.

`id` should be stable across renders for the same logical subscription so the
runtime can keep it armed instead of cancelling and recreating it.

# `none`

```elixir
@spec none() :: []
```

Returns an empty subscription list.

Useful when `subscriptions/1` or helper functions want to return an explicit
"no subscriptions" value.

# `once`

```elixir
@spec once(term(), pos_integer(), term()) :: t()
```

Declares a one-shot self-message subscription.

Like `interval/3`, `id` is used for reconciliation. Once the message fires,
the subscription stays inactive until your app returns it again.

---

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