-
Notifications
You must be signed in to change notification settings - Fork 534
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
chore: clean up span naming #162
Conversation
Codecov Report
@@ Coverage Diff @@
## master #162 +/- ##
=======================================
Coverage 94.10% 94.10%
=======================================
Files 74 74
Lines 3582 3582
Branches 387 387
=======================================
Hits 3371 3371
Misses 211 211
|
@johnbley Is there a plan to do the same for |
Yes, working my way through a number of smaller issues like this. Doing one area at a time to not overwhelm the maintainers. 😄 |
@obecny particularly looking for your feedback on this one |
/** | ||
* Controls whether or not to create a span, based on the event type. | ||
*/ | ||
protected allowEventType(eventType: string): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be private as it is not used by any subclass?
Prefix protected and private methods with _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to leave a way for users to specialize their own list of "interesting enough" events (possibly even dynamic, unlike with a config item). If that's not cool I can make it private. Either way I'll prefix with _
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By writing an instrumentation module which extends ours? that is an interesting idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: perhaps the lint rules could be expanded to enforce the naming?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can either add such possibility to a plugin config. This can be a 2 callbacks
{
allowEventType(eventType: string) {
if (eventType === ....) { // write your own logic
return true;
}
},
updateSpanName(target: HTMLElement) {
// write your own logic
return 'spanName';
}
}
By default I would support click event only
For event better convenience the plugin could have the 2 public methods with the same name that can be simply override. This way it would allow you to create a plugin without necessity of configuration. Such solution would satisfy anyone then and would allow much more customisation
Sorry, not understanding this. You would like
Will do. |
I meant when you instantiate plugin
and 2nd possibility
|
This (strongly typed) is my preference - easier for IDEs, static tools, etc. to analyze/understand the specialization. That's what the current patch uses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the simpler names, and the xpath is still available as an attribute if needed. The use-case for the protected
method seems valid to me and anyway there is no way to make a method truly private in JS anyways without jumping through crazy hoops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
dblclick
as well asclick