Trapped-Demo.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. smalltalk.addPackage('Trapped-Demo', {});
  2. smalltalk.addClass('App', smalltalk.TrappedFly, [], 'Trapped-Demo');
  3. smalltalk.addMethod(
  4. "_initialize",
  5. smalltalk.method({
  6. selector: "initialize",
  7. category: 'initialization',
  8. fn: function (){
  9. var self=this;
  10. smalltalk.send(self,"_payload_",[smalltalk.HashedCollection._fromPairs_([smalltalk.send("items","__minus_gt",[["hello", "world"]])])]);
  11. return self},
  12. args: [],
  13. source: "initialize\x0a\x09self payload: #{'items'->#('hello' 'world')}",
  14. messageSends: ["payload:", "->"],
  15. referencedClasses: []
  16. }),
  17. smalltalk.App);
  18. smalltalk.addClass('AppView', smalltalk.Widget, [], 'Trapped-Demo');
  19. smalltalk.addMethod(
  20. "_renderOn_",
  21. smalltalk.method({
  22. selector: "renderOn:",
  23. category: 'rendering',
  24. fn: function (html){
  25. var self=this;
  26. smalltalk.send(html,"_h2_",["To-Do List"]);
  27. smalltalk.send(smalltalk.send(html,"_p",[]),"_trapShow_",[["items"]]);
  28. return self},
  29. args: ["html"],
  30. source: "renderOn: html\x0a\x09html h2: 'To-Do List'.\x0a\x09html p trapShow: #('items')",
  31. messageSends: ["h2:", "trapShow:", "p"],
  32. referencedClasses: []
  33. }),
  34. smalltalk.AppView);
  35. smalltalk.addClass('Name', smalltalk.TrappedFly, [], 'Trapped-Demo');
  36. smalltalk.addMethod(
  37. "_initialize",
  38. smalltalk.method({
  39. selector: "initialize",
  40. category: 'initialization',
  41. fn: function (){
  42. var self=this;
  43. smalltalk.send(self,"_payload_",["To-Do List"]);
  44. return self},
  45. args: [],
  46. source: "initialize\x0a\x09self payload: 'To-Do List'",
  47. messageSends: ["payload:"],
  48. referencedClasses: []
  49. }),
  50. smalltalk.Name);
  51. smalltalk.addClass('NameView', smalltalk.Widget, [], 'Trapped-Demo');
  52. smalltalk.addMethod(
  53. "_renderOn_",
  54. smalltalk.method({
  55. selector: "renderOn:",
  56. category: 'rendering',
  57. fn: function (html){
  58. var self=this;
  59. smalltalk.send(smalltalk.send(html,"_root",[]),"_trapShow_",[[]]);
  60. return self},
  61. args: ["html"],
  62. source: "renderOn: html\x0a\x09html root trapShow: #()",
  63. messageSends: ["trapShow:", "root"],
  64. referencedClasses: []
  65. }),
  66. smalltalk.NameView);