/ext-4.1.0_b3/src/core/examples/src/Sample/Developer.js

https://bitbucket.org/srogerf/javascript · JavaScript · 43 lines · 30 code · 12 blank · 1 comment · 1 complexity · 2610034de31654e2990ad558dfedd5dc MD5 · raw file

  1. Ext.define('Sample.Developer', {
  2. extend: 'Sample.Person',
  3. statics: {
  4. averageIQ: 120
  5. },
  6. config: {
  7. languages: ['JavaScript', 'C++', 'Python']
  8. },
  9. constructor: function(config) {
  10. this.isGeek = true;
  11. // Apply a method from the parent class' prototype
  12. return this.callParent(arguments);
  13. },
  14. canCode: function(language) {
  15. return Ext.Array.contains(this.getLanguages(), language);
  16. },
  17. code: function(language) {
  18. if (!this.canCode(language)) {
  19. alert("I can't code in: " + language);
  20. return this;
  21. }
  22. alert("I'm coding in: " + language);
  23. this.eat("Bugs");
  24. return this;
  25. },
  26. clone: function() {
  27. var self = this.statics(),
  28. cloned = new self(this.config);
  29. return cloned;
  30. }
  31. });