getset.js 686 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /** @class */
  2. var Person = makeClass(
  3. /** @lends Person# */
  4. {
  5. /** Set up initial values. */
  6. initialize: function(name) {
  7. },
  8. /** Speak a message. */
  9. say: function(message) {
  10. return this.name + " says: " + message;
  11. },
  12. /**
  13. * The name of the person.
  14. * @type {string}
  15. */
  16. get name() {
  17. return this._name;
  18. },
  19. /**
  20. * @type {string}
  21. * @param val
  22. */
  23. set name(val) {
  24. this._name = name;
  25. },
  26. /**
  27. * @type {number}
  28. */
  29. get age() {
  30. return 25;
  31. }
  32. }
  33. );