Created
April 12, 2013 14:21
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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