LiveLoad.Browser (LiveLoad v0.0.1-rc.51)

Copy Markdown View Source

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.

Summary

Functions

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

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

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.

Types

t()

@type t() :: %LiveLoad.Browser{
  connection:
    {LiveLoad.Browser.Connection.t(), LiveLoad.Browser.Connection.opts()},
  private: %{optional(atom()) => term()},
  supervisor_pid: pid()
}

Functions

drain_metrics(browser)

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

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

new_context(browser)

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

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

put_private(browser, key, value)

@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.