Can an Ember object use mupltiple mixins ? I think mixin is equivalent to interface in Java and in that case there should be provision to implement many mixin here -
App.Movie = Ember.Object.extend(App.FirstMixin, { .. });
If there is a SecondMixin as well , how can this object use that ?
Yes, sure it can. Have a look at the code of the prominent ArrayController Class for instance:
Ember.ArrayController = Ember.ArrayProxy.extend(Ember.ControllerMixin,
Ember.SortableMixin, {
....
});
And actually mixins can be used as an equivalent to Java interfaces, but a mixin is not limited to an interface definition. Mixins are a mean of multiple inheritance and can also provide properties and method implementations to the classes that are using them. So the notion of an interface is to limited for the mixin concept.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With