You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 aminHeight
(the final parameter in the list) you have to do something like this: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:
And all other variables become defaulted.
I imagine this pattern may be useful in many places across the codebase.
The text was updated successfully, but these errors were encountered: