modules.js 784 B

12345678910111213141516171819202122232425262728293031323334353637
  1. var RTL$ = {
  2. extend: function extend(methods){
  3. function Type(){
  4. for(var m in methods)
  5. this[m] = methods[m];
  6. }
  7. Type.prototype = this.prototype;
  8. var result = methods.init;
  9. result.prototype = new Type(); // inherit this.prototype
  10. result.prototype.constructor = result; // to see constructor name in diagnostic
  11. result.extend = extend;
  12. return result;
  13. }
  14. };
  15. var m1 = function (){
  16. var Base = RTL$.extend({
  17. init: function Base(){
  18. }
  19. });
  20. Base.prototype.p = function(){
  21. }
  22. return {
  23. Base: Base
  24. }
  25. }();
  26. var m2 = function (m1){
  27. var T = m1.Base.extend({
  28. init: function T(){
  29. m1.Base.prototype.init.call(this);
  30. }
  31. });
  32. T.prototype.p = function(){
  33. m1.Base.prototype.p.call(this);
  34. }
  35. }(m1);