Kernel-Transcript.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. define("amber_core/Kernel-Transcript", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Kernel-Transcript');
  4. $core.packages["Kernel-Transcript"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Kernel-Transcript');
  6. //>>excludeStart("ide", pragmas.excludeIdeData);
  7. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  8. //>>excludeEnd("ide");
  9. $core.addMethod(
  10. $core.method({
  11. selector: "clear",
  12. protocol: 'printing',
  13. fn: function (){
  14. var self=this;
  15. return self;
  16. },
  17. //>>excludeStart("ide", pragmas.excludeIdeData);
  18. args: [],
  19. source: "clear\x0a\x09\x22no op\x22",
  20. referencedClasses: [],
  21. //>>excludeEnd("ide");
  22. messageSends: []
  23. }),
  24. $globals.ConsoleTranscript);
  25. $core.addMethod(
  26. $core.method({
  27. selector: "cr",
  28. protocol: 'printing',
  29. fn: function (){
  30. var self=this;
  31. return self;
  32. },
  33. //>>excludeStart("ide", pragmas.excludeIdeData);
  34. args: [],
  35. source: "cr\x0a\x09\x22no op\x22",
  36. referencedClasses: [],
  37. //>>excludeEnd("ide");
  38. messageSends: []
  39. }),
  40. $globals.ConsoleTranscript);
  41. $core.addMethod(
  42. $core.method({
  43. selector: "open",
  44. protocol: 'actions',
  45. fn: function (){
  46. var self=this;
  47. return self;
  48. },
  49. //>>excludeStart("ide", pragmas.excludeIdeData);
  50. args: [],
  51. source: "open",
  52. referencedClasses: [],
  53. //>>excludeEnd("ide");
  54. messageSends: []
  55. }),
  56. $globals.ConsoleTranscript);
  57. $core.addMethod(
  58. $core.method({
  59. selector: "show:",
  60. protocol: 'printing',
  61. fn: function (anObject){
  62. var self=this;
  63. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64. return $core.withContext(function($ctx1) {
  65. //>>excludeEnd("ctx");
  66. console.log(String($recv(anObject)._asString()));
  67. return self;
  68. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  70. //>>excludeEnd("ctx");
  71. },
  72. //>>excludeStart("ide", pragmas.excludeIdeData);
  73. args: ["anObject"],
  74. source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<console.log(String($recv(anObject)._asString()))>",
  75. referencedClasses: [],
  76. //>>excludeEnd("ide");
  77. messageSends: []
  78. }),
  79. $globals.ConsoleTranscript);
  80. $core.addMethod(
  81. $core.method({
  82. selector: "initialize",
  83. protocol: 'initialization',
  84. fn: function (){
  85. var self=this;
  86. function $Transcript(){return $globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  87. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  88. return $core.withContext(function($ctx1) {
  89. //>>excludeEnd("ctx");
  90. $recv($Transcript())._registerIfNone_(self._new());
  91. return self;
  92. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  93. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  94. //>>excludeEnd("ctx");
  95. },
  96. //>>excludeStart("ide", pragmas.excludeIdeData);
  97. args: [],
  98. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  99. referencedClasses: ["Transcript"],
  100. //>>excludeEnd("ide");
  101. messageSends: ["registerIfNone:", "new"]
  102. }),
  103. $globals.ConsoleTranscript.klass);
  104. });