Kernel-Transcript.js 2.4 KB

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