class Playwright::ChannelOwner
def self.from(channel)
def self.from(channel) channel.object end
def self.from_nullable(channel)
def self.from_nullable(channel) channel&.object end
def adopt!(child)
def adopt!(child) child.is_a?(ChannelOwner) e ArgumentError.new("child must be a ChannelOwner: #{child.inspect}") send(:update_parent, self)
def after_initialize
def after_initialize
def delete_object_from_child(guid)
def delete_object_from_child(guid) ts.delete(guid)
def dispose!(reason: nil)
def dispose!(reason: nil) n up from parent and connection. ction.send(:delete_object_from_channel_owner, @guid) ollected = reason == 'gc' ose all children. ts.each_value { |object| object.send(:dispose!, reason: reason) } ts.clear
def initialize(parent, type, guid, initializer)
-
initializer
(Hash
) -- -
guid
(String
) -- -
type
(String
) -- -
parent
(Playwright::ChannelOwner|Playwright::Connection
) --
def initialize(parent, type, guid, initializer) @objects = {} if parent.is_a?(ChannelOwner) @connection = parent.instance_variable_get(:@connection) @connection.send(:update_object_from_channel_owner, guid, self) @parent = parent @parent.send(:update_object_from_child, guid, self) elsif parent.is_a?(Connection) @connection = parent @connection.send(:update_object_from_channel_owner, guid, self) else raise ArgumentError.new('parent must be an instance of Playwright::ChannelOwner or Playwright::Connection') end @channel = Channel.new(@connection, guid, object: self) @type = type @guid = guid @initializer = initializer @event_to_subscription_mapping = {} after_initialize end
def inspect
def inspect to_s end
def off(event, callback)
def off(event, callback) super if listener_count(event) == 0 update_subscription(event, false) end end
def on(event, callback)
def on(event, callback) if listener_count(event) == 0 update_subscription(event, true) end super end
def once(event, callback)
def once(event, callback) if listener_count(event) == 0 update_subscription(event, true) end super end
def same_connection?(other)
def same_connection?(other) ction == other.instance_variable_get(:@connection)
def set_event_to_subscription_mapping(event_to_subscription_mapping)
def set_event_to_subscription_mapping(event_to_subscription_mapping) _to_subscription_mapping = event_to_subscription_mapping
def to_s
def to_s "#<#{@guid}>" end
def update_object_from_child(guid, child)
def update_object_from_child(guid, child) ts[guid] = child
def update_parent(new_parent)
def update_parent(new_parent) t.send(:delete_object_from_child, @guid) rent.send(:update_object_from_child, @guid, self) t = new_parent
def update_subscription(event, enabled)
def update_subscription(event, enabled) ol_event = @event_to_subscription_mapping[event] tocol_event oad = { ent: protocol_event, abled: enabled, nnel.async_send_message_to_server('updateSubscription', payload)
def was_collected?
def was_collected? @was_collected end