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

Improve usability for various classes #36

Open
AlexanderWells-diamond opened this issue Jun 8, 2023 · 0 comments
Open

Improve usability for various classes #36

AlexanderWells-diamond opened this issue Jun 8, 2023 · 0 comments
Labels
enhancement New feature or request priority:3

Comments

@AlexanderWells-diamond
Copy link

I came across a minor annoyance when working with the RelativePosition class. It has a fairly long list of arguments, and while they are all defaulted there's no way to declare just e.g. the last variable without also defining all of them so, if you want to specify a minHeight (the final parameter in the list) you have to do something like this:

new RelativePosition("100%", "100%", "0px", "0px", "0px", "0px", "0px")

An alternative design pattern is to use an object for the inputs. The object can be defined with defaults, and would then allow calling the function like this:

new RelativePosition({minHeight: "0px"})

And all other variables become defaulted.

I imagine this pattern may be useful in many places across the codebase.

@AlexanderWells-diamond AlexanderWells-diamond added the enhancement New feature or request label Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority:3
Projects
None yet
Development

No branches or pull requests

2 participants