2
0

Examples.deploy.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. smalltalk.addPackage('Examples', {});
  2. smalltalk.addClass('Counter', smalltalk.Widget, ['count', 'header'], 'Examples');
  3. smalltalk.addMethod(
  4. "_decrease",
  5. smalltalk.method({
  6. selector: "decrease",
  7. fn: function (){
  8. var self=this;
  9. self["@count"]=smalltalk.send(self["@count"],"__minus",[(1)]);
  10. smalltalk.send(self["@header"],"_contents_",[(function(html){
  11. return smalltalk.send(html,"_with_",[smalltalk.send(self["@count"],"_asString",[])]);
  12. })]);
  13. return self}
  14. }),
  15. smalltalk.Counter);
  16. smalltalk.addMethod(
  17. "_increase",
  18. smalltalk.method({
  19. selector: "increase",
  20. fn: function (){
  21. var self=this;
  22. self["@count"]=smalltalk.send(self["@count"],"__plus",[(1)]);
  23. smalltalk.send(self["@header"],"_contents_",[(function(html){
  24. return smalltalk.send(html,"_with_",[smalltalk.send(self["@count"],"_asString",[])]);
  25. })]);
  26. return self}
  27. }),
  28. smalltalk.Counter);
  29. smalltalk.addMethod(
  30. "_initialize",
  31. smalltalk.method({
  32. selector: "initialize",
  33. fn: function (){
  34. var self=this;
  35. smalltalk.send(self,"_initialize",[],smalltalk.Widget);
  36. self["@count"]=(0);
  37. return self}
  38. }),
  39. smalltalk.Counter);
  40. smalltalk.addMethod(
  41. "_renderOn_",
  42. smalltalk.method({
  43. selector: "renderOn:",
  44. fn: function (html){
  45. var self=this;
  46. var $1,$2,$3,$4,$5,$6;
  47. $1=smalltalk.send(html,"_h1",[]);
  48. smalltalk.send($1,"_with_",[smalltalk.send(self["@count"],"_asString",[])]);
  49. $2=smalltalk.send($1,"_yourself",[]);
  50. self["@header"]=$2;
  51. $3=smalltalk.send(html,"_button",[]);
  52. smalltalk.send($3,"_with_",["++"]);
  53. $4=smalltalk.send($3,"_onClick_",[(function(){
  54. return smalltalk.send(self,"_increase",[]);
  55. })]);
  56. $5=smalltalk.send(html,"_button",[]);
  57. smalltalk.send($5,"_with_",["--"]);
  58. $6=smalltalk.send($5,"_onClick_",[(function(){
  59. return smalltalk.send(self,"_decrease",[]);
  60. })]);
  61. return self}
  62. }),
  63. smalltalk.Counter);
  64. smalltalk.addMethod(
  65. "_tryExample",
  66. smalltalk.method({
  67. selector: "tryExample",
  68. fn: function (){
  69. var self=this;
  70. smalltalk.send(smalltalk.send(self,"_new",[]),"_appendToJQuery_",[smalltalk.send("body","_asJQuery",[])]);
  71. return self}
  72. }),
  73. smalltalk.Counter.klass);