Skip to content

Commit

Permalink
chore: remove dedicated console channel
Browse files Browse the repository at this point in the history
  • Loading branch information
YusukeIwaki committed Oct 25, 2023
1 parent cc18ec2 commit 91c28f4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
1 change: 1 addition & 0 deletions development/generate_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
API_IMPLEMENTATIONS = %w[
Accessibility
AndroidInput
ConsoleMessage
FileChooser
Keyboard
Mouse
Expand Down
2 changes: 1 addition & 1 deletion lib/playwright/channel_owners/browser_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module Playwright
on_service_worker(ChannelOwners::Worker.from(params['worker']))
})
@channel.on('console', ->(params) {
on_console_message(ChannelOwners::ConsoleMessage.from(params['message']))
on_console_message(ConsoleMessageImpl.new(params))
})
@channel.on('pageError', ->(params) {
on_page_error(
Expand Down
25 changes: 0 additions & 25 deletions lib/playwright/channel_owners/console_message.rb

This file was deleted.

29 changes: 29 additions & 0 deletions lib/playwright/console_message_impl.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module Playwright
define_api_implementation :ConsoleMessageImpl do
def initialize(event)
@event = event
end

def page
@page ||= ChannelOwners::Page.from_nullable(@event['page'])
end

def type
@event['type']
end

def text
@event['text']
end

def args
@event['args']&.map do |arg|
ChannelOwner.from(arg)
end
end

def location
@event['location']
end
end
end

0 comments on commit 91c28f4

Please sign in to comment.