PDA

View Full Version : mixin life cycle - need more docs



gkatz
20 Dec 2012, 2:22 AM
the class system mixins tutorial is very dull. it does not state if the mixins have a constructor/initialize functions (I think they don't) even though they are defined as objects.
the example in the docs are too plain and do not explain the subject in depth.
thanks.

mitchellsimoens
22 Dec 2012, 7:15 AM
A mixin isn't really created. Ext.Base takes the prototype of the mixins and merges it onto the class you are using it on. If there is a method/property on the mixin that is already on the class, the item on the mixin will not be merged on the class so if you have a constructor method on the mixin it won't overwrite the one on the class.

So the methods are then available to the scope of the class or you can execute the methods on the mixin itself via this.mixins.mixinname.method.call(this);

gkatz
23 Dec 2012, 3:38 AM
got it. thanks!

Makha
28 Feb 2017, 5:02 AM
When merging process starts? I've overridden one of the methods of Mixin, but it hasn't been overrode in target class. So I assume that merging goes before overriding. If it is true, how to override mixins method properly?