Class: Playwright::Channel

Inherits:
Object
  • Object
show all
Includes:
EventEmitter
Defined in:
lib/playwright/channel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EventEmitter

#emit, #off, #on, #once

Constructor Details

#initialize(connection, guid, object:) ⇒ Channel

Returns a new instance of Channel.

Parameters:



8
9
10
11
12
# File 'lib/playwright/channel.rb', line 8

def initialize(connection, guid, object:)
  @connection = connection
  @guid = guid
  @object = object
end

Instance Attribute Details

#guidObject (readonly)

Returns the value of attribute guid.



14
15
16
# File 'lib/playwright/channel.rb', line 14

def guid
  @guid
end

#objectObject (readonly)

Returns the value of attribute object.



14
15
16
# File 'lib/playwright/channel.rb', line 14

def object
  @object
end

Instance Method Details

#async_send_message_to_server(method, params = {}) ⇒ Object

Parameters:

  • method (String)
  • params (Hash) (defaults to: {})


24
25
26
27
28
29
30
31
32
33
# File 'lib/playwright/channel.rb', line 24

def async_send_message_to_server(method, params = {})
  @connection.async_send_message_to_server(@guid, method, params).then do |result|
    if result.is_a?(Hash)
      _type, channel_owner = result.first
      channel_owner
    else
      nil
    end
  end
end

#send_message_to_server(method, params = {}) ⇒ Object

Parameters:

  • method (String)
  • params (Hash) (defaults to: {})


18
19
20
# File 'lib/playwright/channel.rb', line 18

def send_message_to_server(method, params = {})
  async_send_message_to_server(method, params).value!
end