-
just curious. the other attributes are as-is, so i'm not quite sure what could be gained by making nonObservedAttributes a function returning an object (or under what circumstances it would be called more than one on a component). granted, that's some impressive type-scripting to get the rest of the methods to recognize "this.x" exists from that function. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I mean, i'm not arguing as such - you coded this for your purposes (and very well). Just curious what the use-case was for this particular case. |
Beta Was this translation helpful? Give feedback.
-
It is mostly intended for complete objects that cannot be cloned. The function allows it to act as a constructor. In normal cases I take the "attributes" and clone them with a proxy, which allows the instance to not be shared between components. There are objects that cannot be cloned easily or the complexity of observing them is very high. For those cases, I use nonObservedAttributes |
Beta Was this translation helpful? Give feedback.
It is mostly intended for complete objects that cannot be cloned. The function allows it to act as a constructor. In normal cases I take the "attributes" and clone them with a proxy, which allows the instance to not be shared between components. There are objects that cannot be cloned easily or the complexity of observing them is very high. For those cases, I use nonObservedAttributes