Namespace.js 770 B

12345678910111213141516171819202122232425262728293031
  1. Type.registerNamespace("Demo");
  2. Demo.Person = function(firstName, lastName, emailAddress) {
  3. this._firstName = firstName;
  4. this._lastName = lastName;
  5. this._emailAddress = emailAddress;
  6. }
  7. Demo.Person.prototype = {
  8. getFirstName: function() {
  9. return this._firstName;
  10. },
  11. getLastName: function() {
  12. return this._lastName;
  13. },
  14. getName: function() {
  15. return this._firstName + ' ' + this._lastName;
  16. },
  17. dispose: function() {
  18. alert('bye ' + this.getName());
  19. }
  20. }
  21. Demo.Person.registerClass('Demo.Person', null, Sys.IDisposable);
  22. // Notify ScriptManager that this is the end of the script.
  23. if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();