Kernel-Transcript.js 2.5 KB

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