Skip to content

Instantly share code, notes, and snippets.

@telekosmos
Created April 12, 2013 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save telekosmos/5372354 to your computer and use it in GitHub Desktop.
Save telekosmos/5372354 to your computer and use it in GitHub Desktop.
Comparison between class members and configs in ExtJs 4 class model. It seems the configs are diff from members regarding to getter/setter methods created, apply methods created and no straight access to configs (as opposite to members). In addition, members are read-write
Ext.define('My.sample.Person', {
/** @readonly */
name: 'Unknown',
config: {
midname: undefined
},
constructor: function(name, config) {
this.initConfig(config);
this.name = name;
},
eat: function(foodType) {
console.log(this.name + " is eating: " + foodType);
},
fullName: function () {
return this.name +' '+this.getMidname();
}
});
var aaron = Ext.create('My.sample.Person', 'Aarron', {
midname: 'Afflalo'
});
aaron.eat("Salad"); // alert("Aaron is eating: Salad");
console.log('Name for aaron: '+aaron.name);
console.log('Fullname: '+aaron.fullName());
aaron.name = 'Benito';
console.log('New name for aaron: '+aaron.name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment