# `LiveLoad.Browser`
[🔗](https://github.com/probably-not/live-load/blob/v0.1.1/lib/live_load/browser.ex#L1)

`LiveLoad.Browser` is the struct representing the browser abstraction that is used in a `LiveLoad.Scenario`.
It wraps the given implementation of the `LiveLoad.Browser.Connection` behaviour. All operations on the browser
instance are delegated to the `LiveLoad.Browser.Connection` implementation.

`LiveLoad.Browser` is the top-level of the Browser hierarchy. For every node running a `LiveLoad.Scenario`, a
single `LiveLoad.Browser` is created, and each user receives a clean, isolated `LiveLoad.Browser.Context` created
via `LiveLoad.Browser.new_context/1`.

For operations users can take on the context, see the `LiveLoad.Browser.Context` module.

# `t`

```elixir
@type t() :: %LiveLoad.Browser{
  connection:
    {LiveLoad.Browser.Connection.t(), LiveLoad.Browser.Connection.opts()},
  private: %{optional(atom()) =&gt; term()},
  supervisor_pid: pid()
}
```

# `drain_metrics`

```elixir
@spec drain_metrics(browser :: t()) :: :ok
```

Delegates to the connection implementation on the browser and runs
the `c:LiveLoad.Browser.Connection.drain_metrics/1` callback found on the implementation.

# `new_context`

```elixir
@spec new_context(browser :: t()) ::
  {:ok, LiveLoad.Browser.Context.t()} | {:error, term()}
```

Delegates to the connection implementation on the browser and runs
the `c:LiveLoad.Browser.Connection.new_context/1` callback found on the implementation.

# `put_private`

```elixir
@spec put_private(browser :: t(), key :: atom(), value :: term()) :: t()
```

Set a value on the private field on the browser struct.
This is useful for Connection implementations to add private data
that they need access to while running.

