# `Drafter.Runtime.Callback`
[🔗](https://github.com/jaman/drafter/blob/main/lib/drafter/runtime/callback.ex#L1)

Default LiveView-style runtime backend.

Adapts the loop to an app's `mount/1`, `handle_event/2` (raw input events),
`handle_event/3` (named callbacks), and the optional lifecycle hooks. Optional
hooks that an app does not define fall through to returning the state unchanged.

# `handle_input`

```elixir
@spec handle_input(module(), term(), term()) :: term()
```

Calls the app's `handle_event/2` with the raw event tuple.

# `handle_message`

```elixir
@spec handle_message(module(), atom(), term(), term()) :: term()
```

Calls the app's `handle_event/3` with the callback name and its payload.

# `mount`

```elixir
@spec mount(module(), map()) :: term()
```

Calls the app's `mount/1` with the mount props.

# `on_message`

```elixir
@spec on_message(module(), term(), term()) :: term()
```

Calls the app's `on_message/2` if it defines one, otherwise returns `state` unchanged.

# `ready`

```elixir
@spec ready(module(), term()) :: term()
```

Calls the app's `on_ready/1` if it defines one, otherwise returns `state` unchanged.

# `refresh_rate`

```elixir
@spec refresh_rate(module()) :: Drafter.Runtime.refresh_rate()
```

The app's `refresh_rate/0` if it defines one, otherwise `nil`.

# `scroll_active`

```elixir
@spec scroll_active(module(), term()) :: term()
```

Calls the app's `on_scroll_active/1` if it defines one, otherwise returns `state` unchanged.

# `scroll_idle`

```elixir
@spec scroll_idle(module(), term()) :: term()
```

Calls the app's `on_scroll_idle/1` if it defines one, otherwise returns `state` unchanged.

# `timer`

```elixir
@spec timer(module(), term(), term()) :: term()
```

Calls the app's `on_timer/2` if it defines one, otherwise returns `state` unchanged.

# `unmount`

```elixir
@spec unmount(module(), term()) :: :ok
```

Calls the app's `unmount/1` if it defines one.

---

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