View Source Playwright.Response (playwright v1.44.0-alpha.4)

...

Summary

Types

t()

%Playwright.Response{}

Functions

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

Types

@type t() :: %Playwright.Response{
  frame: term(),
  guid: term(),
  headers: term(),
  initializer: term(),
  listeners: term(),
  parent: term(),
  request: term(),
  session: term(),
  status: term(),
  status_text: term(),
  type: term(),
  url: term()
}

%Playwright.Response{}

Functions

@spec body(t()) :: binary()
Link to this function

init(owner, initializer)

View Source
@spec init(
  struct(),
  map()
) :: {atom(), struct()}

Optional callback implementation for Playwright.SDK.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(%{session: session} = owner, _initializer) do
  Channel.bind(session, {:guid, owner.guid}, :close, fn event ->
    Logger.warning("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.
@spec ok(t()) :: boolean()
@spec ok({t(), t()}) :: boolean()
@spec text(t()) :: binary()