Results 1 to 4 of 4

Thread: Ext.mixin.Observable - constructor question

  1. #1
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    2,425
    Answers
    20

    Default Answered: Ext.mixin.Observable - constructor question

    Why mixinConfig allows connecting to the destroy method but not to the constructor?

    I thought the idea of using the Ext.Mixin base class was to reduce boilerplate code, but it appears constructor invocation can't be configured.

    Code:
    Ext.define('Ext.mixin.Observable', {
        requires: ['Ext.event.Dispatcher'],
        extend: 'Ext.Mixin',
        ...
        mixinConfig: {
            id: 'observable',
            after: {
                destroy: 'destroy'
            }
        },
        ...
    ******
    Ext.define('Ext.data.AbstractStore', {
        mixins: [
            'Ext.mixin.Observable',
            'Ext.mixin.Factoryable'
        ],
        ...
        constructor: function(config) {
            ...
            me.mixins.observable.constructor.call(me, config); // <-- why this is not configured in mixinConfig?
            ...
        },
        ...

  2. To give you control over the timing. With the config, you only get either before or after. It's often the case (we certainly need to) call the constructor at specific points.

  3. #2
    Sencha User dongryphon's Avatar
    Join Date
    Jul 2009
    Location
    Kansas
    Posts
    1,748
    Answers
    55

    Default

    If you are asking whether mixinConfig works for "constructor" ... it does: https://fiddle.sencha.com/#fiddle/4ql
    Don Griffin

    "Use the source, Luke!"

  4. #3
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    2,425
    Answers
    20

    Default

    Quote Originally Posted by dongryphon View Post
    If you are asking whether mixinConfig works for "constructor" ... it does: https://fiddle.sencha.com/#fiddle/4ql
    Cool, then I must ask why is the observable constructor not included in the mixinConfig together with the destroy method?

  5. #4
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,255
    Answers
    759

    Default

    To give you control over the timing. With the config, you only get either before or after. It's often the case (we certainly need to) call the constructor at specific points.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •