RTL$.js 681 B

1234567891011121314151617181920212223
  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. assert: function (condition, code){
  15. if (!condition)
  16. throw new Error("assertion failed"
  17. + ((code !== undefined) ? " with code " + code : ""));
  18. }
  19. };
  20. exports.RTL$ = RTL$;