/ext-4.1.0_b3/src/core/examples/src/Sample/Developer.js
JavaScript | 43 lines | 30 code | 12 blank | 1 comment | 1 complexity | 2610034de31654e2990ad558dfedd5dc MD5 | raw file
1Ext.define('Sample.Developer', {
2 extend: 'Sample.Person',
3
4 statics: {
5 averageIQ: 120
6 },
7
8 config: {
9 languages: ['JavaScript', 'C++', 'Python']
10 },
11
12 constructor: function(config) {
13 this.isGeek = true;
14
15 // Apply a method from the parent class' prototype
16 return this.callParent(arguments);
17 },
18
19 canCode: function(language) {
20 return Ext.Array.contains(this.getLanguages(), language);
21 },
22
23 code: function(language) {
24 if (!this.canCode(language)) {
25 alert("I can't code in: " + language);
26
27 return this;
28 }
29
30 alert("I'm coding in: " + language);
31
32 this.eat("Bugs");
33
34 return this;
35 },
36
37 clone: function() {
38 var self = this.statics(),
39 cloned = new self(this.config);
40
41 return cloned;
42 }
43});