Injecting dependency into a class that is mixed into another?

Skip to first unread message

Dec 18, 2014, 6:10:50 PM12/18/14
Hey, here's some pseudo code of my problem:

Ext.define('A', {

    mixins: [

    inject: [

    test: function() {


Ext.define('B', {

    mixins: [


var b = Ext.create('B');

b.test(); // FAIL

b.test() fails because xy has not been injected into A. I think this is because the Injectable hooks into 'before constructor' of the class it is applied to (A). However in this case A is mixed into B and as I understood the constructor of a mixed in class is never called. What can I do here? Or do i miss something?

Brian Kotek

Dec 18, 2014, 6:37:27 PM12/18/14
to deftjs
Hmm, I really have no idea if this will work (I've certainly never tried it). You might try manually calling the mixin constructor from the target class constructor, similar to how Ext.util.Observable works (!/api/Ext.util.Observable).

Deft JS home page:
For rules and tips on asking questions on the Deft JS mailing list:
You received this message because you are subscribed to the Google Groups "Deft JS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit
Reply all
Reply to author
0 new messages