Kernel-Transcript.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. args: [],
  15. source: "clear\x0a\x09\x22no op\x22",
  16. messageSends: [],
  17. referencedClasses: []
  18. }),
  19. globals.ConsoleTranscript);
  20. smalltalk.addMethod(
  21. smalltalk.method({
  22. selector: "cr",
  23. protocol: 'printing',
  24. fn: function (){
  25. var self=this;
  26. return self},
  27. args: [],
  28. source: "cr\x0a\x09\x22no op\x22",
  29. messageSends: [],
  30. referencedClasses: []
  31. }),
  32. globals.ConsoleTranscript);
  33. smalltalk.addMethod(
  34. smalltalk.method({
  35. selector: "open",
  36. protocol: 'actions',
  37. fn: function (){
  38. var self=this;
  39. return self},
  40. args: [],
  41. source: "open",
  42. messageSends: [],
  43. referencedClasses: []
  44. }),
  45. globals.ConsoleTranscript);
  46. smalltalk.addMethod(
  47. smalltalk.method({
  48. selector: "show:",
  49. protocol: 'printing',
  50. fn: function (anObject){
  51. var self=this;
  52. return smalltalk.withContext(function($ctx1) {
  53. console.log(String(_st(anObject)._asString()));
  54. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.ConsoleTranscript)})},
  55. args: ["anObject"],
  56. 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()))>",
  57. messageSends: [],
  58. referencedClasses: []
  59. }),
  60. globals.ConsoleTranscript);
  61. smalltalk.addMethod(
  62. smalltalk.method({
  63. selector: "initialize",
  64. protocol: 'initialization',
  65. fn: function (){
  66. var self=this;
  67. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  68. return smalltalk.withContext(function($ctx1) {
  69. _st($Transcript())._registerIfNone_(self._new());
  70. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleTranscript.klass)})},
  71. args: [],
  72. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  73. messageSends: ["registerIfNone:", "new"],
  74. referencedClasses: ["Transcript"]
  75. }),
  76. globals.ConsoleTranscript.klass);
  77. });