Replies: 6 comments
-
I don't know if the That said, I think your issue in the snippet you posted is that you're putting an instance type in the registry, not a constructor type. If you use |
Beta Was this translation helpful? Give feedback.
-
@dfreeman - are you sure subclassing the built-in components is/will be deprecated? I quickly glanced over the RFC and didn't see that? Can you point us to the text please? |
Beta Was this translation helpful? Give feedback.
-
Subclassing is called out near the bottom of the "The Problems" section as something that leaks implementation details. Because of this, the fact that they are implemented as `Ember.Component`
subclasses are highly observable. Some common use cases and consequences are:
1. These classes can be imported for subclassing. For example, an app can
export a custom subclass of `TextField` at, say, `app/components/my-text-field.js`
which can then be invoked as <MyTextField>.
<!-- ... -->
These are all opportunities for the internal implementation to leak, therefore
making changes to how the built-in components are implemented – specifically
stop subclassing from `Ember.Component` – will likely be a breaking change for
some, even if the new implementations otherwise supported all documented APIs
perfectly. In @wagenet's snippet above, accessing |
Beta Was this translation helpful? Give feedback.
-
Yes, in this case I understand. But if one subclasses and uses only "public API" stuff... I'm not sure that is a problem. It is actually impossible to prevent that. In any case sorry for the off-topic here. |
Beta Was this translation helpful? Give feedback.
-
That's exactly the point though—there is no public API for components outside of templates 😄 Even the fact that the component is a class is an implementation detail, since I could equally make a random POJO |
Beta Was this translation helpful? Give feedback.
-
I still couldn't figure this out, but I decided to just change stuff to not subclass. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to declare alternate types for a component?
This is my attempt:
Unfortunately, it doesn't seem to work.
Beta Was this translation helpful? Give feedback.
All reactions