Kernel-Transcript.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. return smalltalk.withContext(function($ctx1) {
  52. console.log(String(_st(anObject)._asString()));
  53. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.ConsoleTranscript)})},
  54. args: ["anObject"],
  55. 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()))>",
  56. messageSends: [],
  57. referencedClasses: []
  58. }),
  59. globals.ConsoleTranscript);
  60. smalltalk.addMethod(
  61. smalltalk.method({
  62. selector: "initialize",
  63. protocol: 'initialization',
  64. fn: function (){
  65. var self=this;
  66. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  67. return smalltalk.withContext(function($ctx1) {
  68. _st($Transcript())._registerIfNone_(self._new());
  69. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleTranscript.klass)})},
  70. args: [],
  71. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  72. messageSends: ["registerIfNone:", "new"],
  73. referencedClasses: ["Transcript"]
  74. }),
  75. globals.ConsoleTranscript.klass);
  76. });