Results 1 to 4 of 4

Thread: What is equivalent of ST1 Observable.capture method?

  1. #1
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    103
    Vote Rating
    7
      0  

    Default Answered: What is equivalent of ST1 Observable.capture method?

    What is the equivalent in ST2 of the ST1 Ext.util.Observable.capture call? I made use of this method quite a bit in debugging to see all events coming off an object and the timing of the calls. If possible I would like to continue using it.

  2. There isn't one built in. All the capture function did was create an interceptor to the fireEvent function. So what you could do is override Ext.mixin.Obervable hook into the fireEvent and fireAction methods:

    Code:
    Ext.define('Override.mixin.Observable', {
        override : 'Ext.mixin.Observable',
    
        fireEvent : function(eventName) {
            console.log(eventName);
    
            this.callOverridden(arguments);
        },
    
        fireAction : function(eventName) {
            console.log(eventName);
    
            this.callOverridden(arguments);
        }
    });

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    There isn't one built in. All the capture function did was create an interceptor to the fireEvent function. So what you could do is override Ext.mixin.Obervable hook into the fireEvent and fireAction methods:

    Code:
    Ext.define('Override.mixin.Observable', {
        override : 'Ext.mixin.Observable',
    
        fireEvent : function(eventName) {
            console.log(eventName);
    
            this.callOverridden(arguments);
        },
    
        fireAction : function(eventName) {
            console.log(eventName);
    
            this.callOverridden(arguments);
        }
    });
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    103
    Vote Rating
    7
      0  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    There isn't one built in. All the capture function did was create an interceptor to the fireEvent function. So what you could do is override Ext.mixin.Obervable hook into the fireEvent and fireAction methods:

    Code:
    Ext.define('Override.mixin.Observable', {
        override : 'Ext.mixin.Observable',
    
        fireEvent : function(eventName) {
            console.log(eventName);
    
            this.callOverridden(arguments);
        },
    
        fireAction : function(eventName) {
            console.log(eventName);
    
            this.callOverridden(arguments);
        }
    });
    Thanks mitchellsimoens. This looks perfect. I think it also answers another question for me. Namely, is this the recommended way to do what used to be done with Ext.override? I have a file full of those from ST1 where I patched classes with bug fixes.

  5. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    yes it is. Just like your application classes can be dynamically loaded, using Ext.define for overrides can now be dynamically loaded also.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

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