I’m adding a script instance at runtime like this official example.
If you want to set the value to an attribute on construction, you actually need to do this:
But, this is also required to add this at the end of your JS class file, to make attributes accessible on creation:
Is there a way to do something like this instead?
Because attributes need to be set after registering the class, I do that at the end of the file. The problem is that I only need to do that on attributes that need to be set on construction. The other attributes can be set directly or by the “setter” method, meaning that I need the declare my attributes in 2 ways.
It is not a blocker actually, I’m just looking to improve the readability and organization of my code.
Thank you for the help.