Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor event #31

Merged
merged 6 commits into from Nov 24, 2020
Merged

Refactor event #31

merged 6 commits into from Nov 24, 2020

Conversation

YusukeIwaki
Copy link
Owner

The logic of Page#on in puppeteer-ruby was far different from original (JS) implementation.

This PR introduces Events constants and makes the method similar to the original implementation.
Also, introduces XXXEmittedEvents, which is already introduces in puppeteer JS puppeteer/puppeteer#6179 or puppeteer/puppeteer#6174


refine Hash do
def define_const_into(target_module)
self.each do |key, value|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop] reported by reviewdog 🐶
Style/RedundantSelf: Redundant self detected.

target_module.const_set(key, value)
target_module.define_singleton_method(key) { value }
end
keyset = Set.new(self.keys)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop] reported by reviewdog 🐶
Style/RedundantSelf: Redundant self detected.

target_module.define_singleton_method(key) { value }
end
keyset = Set.new(self.keys)
valueset = Set.new(self.values)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop] reported by reviewdog 🐶
Style/RedundantSelf: Redundant self detected.

FrameDetached: Symbol('FrameManager.FrameDetached'),
LifecycleEvent: Symbol('FrameManager.LifecycleEvent'),
FrameNavigatedWithinDocument: Symbol(
'FrameManager.FrameNavigatedWithinDocument'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop] reported by reviewdog 🐶
Style/TrailingCommaInArguments: Put a comma after the last parameter of a multiline method call.


# @see https://github.com/puppeteer/puppeteer/blob/main/src/common/Events.ts
{
Page: {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems Events.ts will be removed in future.

It would be better to define these constants in PageEmittedEvents

@YusukeIwaki YusukeIwaki merged commit 2ed3b25 into master Nov 24, 2020
@YusukeIwaki YusukeIwaki deleted the refactor_event branch November 24, 2020 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant