-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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: remove underscores and clean up scrollbar.ts #6584
chore: remove underscores and clean up scrollbar.ts #6584
Conversation
core/scrollbar.ts
Outdated
// Store the thickness in a temp variable for readability. | ||
const scrollbarThickness = Scrollbar.scrollbarThickness; |
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.
The comment is not very interesting, and probably needn't have been preserved.
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.
Removed.
/** | ||
* Set the size of the scrollbar DOM elements along the minor axis. | ||
*/ | ||
private setInitialThickness() { |
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.
Opinion: I would probably not have bothered extracting this as a separate method.
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.
Extracting it makes the constructor fit in a single window for me without rotating my monitor :)
I actually would rather have extracted the lengthAttribute
/positionAttribute
setting as well, but doing it directly in the constructor means that the compiler is certain about nullability.
core/scrollbar.ts
Outdated
if (this.svgHandle_) { | ||
this.workspace.getThemeManager().unsubscribe(this.svgHandle_); | ||
} | ||
this.workspace.getThemeManager().unsubscribe(this.svgHandle_); | ||
} |
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.
Aside: how did this not fail our format check??
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.
Oh, huh. It looks fine here, but in the side-by-side diff it looked like it was previously:
if (this.svgHandle_) {
this.workspace.getThemeManager().unsubscribe(this.svgHandle_);
}
}
The basics
npm run format
andnpm run lint
The details
Resolves
Part of #6548
Proposed Changes
In three commits:
dispose
to remove the scrollbar's root node but not set anything else tonull
. This also helped with nullability. The garbage collector is in charge of the rest of cleanup.Behavior Before Change
No change.
Behavior After Change
No change.
Reason for Changes
Cleanup, and reading code to understand dependencies.
Test Coverage
Mocha tests, but I also opened up the playground and both dragged and clicked scrollbars in several situations:
Documentation
None
Additional Information