Playwright.ConsoleMessage (playwright v0.1.17-preview-3) View Source

Playwright.ConsoleMessage instances are dispatched by page and handled via Playwright.Page.on/3 for the :console event type.

Link to this section Summary

Types

t()

%Playwright.ConsoleMessage{}

Functions

Optional callback implementation for Playwright.ChannelOwner.init/2.

Link to this section Types

Specs

t() :: %Playwright.ConsoleMessage{
  connection: term(),
  guid: term(),
  initializer: term(),
  listeners: term(),
  message_text: term(),
  message_type: term(),
  parent: term(),
  type: term()
}

%Playwright.ConsoleMessage{}

Link to this section Functions

Link to this function

init(owner, initializer)

View Source

Specs

init(
  struct(),
  map()
) :: {atom(), struct()}

Optional callback implementation for Playwright.ChannelOwner.init/2.

If implemented, the callback will receive:

  1. The newly created "channel owner" struct.
  2. The :initializer received from the Playwright browser server.

The implementation has the option of "patching" the struct as stored in the catalog, and/or binding event handlers.

Example

def init(owner, _initializer) do
  Channel.bind(owner, :close, fn event ->
    Logger.warn("Closing #{inspect(event.target)}")
  end)

  {:ok, %{owner | version: "1.2.3"}}
end

Returns

  • {:ok, struct()}

Arguments

key / nametypedescription
ownerparamstruct()The newly created channel owner (resource).
initializerparamstruct()The initializer received from with the channel owner instance was derived.