Trapped-Demo.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. smalltalk.addPackage('Trapped-Demo', {});
  2. smalltalk.addClass('App', smalltalk.TrappedPlainModel, [], '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,"_initialize",[],smalltalk.TrappedPlainModel);
  11. smalltalk.send(self,"_payload_",[smalltalk.HashedCollection._fromPairs_([smalltalk.send("items","__minus_gt",[["hello", "world"]]),smalltalk.send("title","__minus_gt",["To-Do List"])])]);
  12. return self},
  13. args: [],
  14. source: "initialize\x0a\x09super initialize.\x0a\x09self payload: #{'items'->#('hello' 'world'). 'title' -> 'To-Do List'}",
  15. messageSends: ["initialize", "payload:", "->"],
  16. referencedClasses: []
  17. }),
  18. smalltalk.App);
  19. smalltalk.addClass('AppView', smalltalk.Widget, [], 'Trapped-Demo');
  20. smalltalk.addMethod(
  21. "_renderOn_",
  22. smalltalk.method({
  23. selector: "renderOn:",
  24. category: 'rendering',
  25. fn: function (html){
  26. var self=this;
  27. smalltalk.send(smalltalk.send(html,"_h2",[]),"_trapShow_",[["title"]]);
  28. smalltalk.send(smalltalk.send(html,"_p",[]),"_trapShow_",[["items"]]);
  29. return self},
  30. args: ["html"],
  31. source: "renderOn: html\x0a\x09html h2 trapShow: #('title').\x0a\x09html p trapShow: #('items')",
  32. messageSends: ["trapShow:", "h2", "p"],
  33. referencedClasses: []
  34. }),
  35. smalltalk.AppView);