Ext in statics () and self

var self = this; 
var statics = self.statics (); static member of the class // where (instance.statics (): follow the class where to go, in which class, which returns the class static member statics)
self.self clazz = var; // get a reference to the class instance of the class (instance.self: go along with instances of the class, instance is an instance of what class, instance.self which it returns a reference to the class)
Ext.define('org.pine.some.Dog',{
    statics to: { // Static member 
      instanceCount: 0, // Example 
      Species: 'Dog' // species 
    },
    config:{
        
    },
    constructor:function(config){
      var self = this;    
      self.initConfig(config);
      
      var statics = self.statics (); // class where the static member (instance.statics (): follow the class where to go, in which class, which returns the class static member statics) 
      console.info ( 'statics. Species: ' , statics.species);
      
      var clazz = self.self; // acquired by reference to the class instance of the class (instance.self: go along with an instance of the class, instance is an instance of the class which, instance.self which returns a reference to class) 
      console.info ( ' clazz.species: ' , clazz.species);
      
      statics.instanceCount++;
      self.callParent(arguments);
    },
    /**
     * Examples of cloning
     * / 
    Clone: function () {
       var Self = the this ;
       var clazz = self.self; // acquired by reference to the class instance of the class 
      var instance = new new clazz (); // reference to an instance of the class generated by the class
      
      var statics to self.statics = (); // where static class member 
      instance [ 'Species'] = statics.species; // add an attribute 
      return instance;      
    }
});

 

 

Guess you like

Origin www.cnblogs.com/web-record/p/12060330.html