1
0

Kernel-Transcript.js 3.3 KB

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