1
0

Examples.deploy.js 2.9 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. return smalltalk.withContext(function($ctx1) { self["@count"]=_st(self["@count"]).__minus((1));
  10. _st(self["@header"])._contents_((function(html){
  11. return smalltalk.withContext(function($ctx2) { return _st(html)._with_(_st(self["@count"])._asString());
  12. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}));
  13. return self}, function($ctx1) {$ctx1.fill(self,"decrease",{}, smalltalk.Counter)})},
  14. messageSends: ["-", "contents:", "with:", "asString"]}),
  15. smalltalk.Counter);
  16. smalltalk.addMethod(
  17. "_increase",
  18. smalltalk.method({
  19. selector: "increase",
  20. fn: function (){
  21. var self=this;
  22. return smalltalk.withContext(function($ctx1) { self["@count"]=_st(self["@count"]).__plus((1));
  23. _st(self["@header"])._contents_((function(html){
  24. return smalltalk.withContext(function($ctx2) { return _st(html)._with_(_st(self["@count"])._asString());
  25. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}));
  26. return self}, function($ctx1) {$ctx1.fill(self,"increase",{}, smalltalk.Counter)})},
  27. messageSends: ["+", "contents:", "with:", "asString"]}),
  28. smalltalk.Counter);
  29. smalltalk.addMethod(
  30. "_initialize",
  31. smalltalk.method({
  32. selector: "initialize",
  33. fn: function (){
  34. var self=this;
  35. return smalltalk.withContext(function($ctx1) { smalltalk.Widget.fn.prototype._initialize.apply(_st(self), []);
  36. self["@count"]=(0);
  37. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Counter)})},
  38. messageSends: ["initialize"]}),
  39. smalltalk.Counter);
  40. smalltalk.addMethod(
  41. "_renderOn_",
  42. smalltalk.method({
  43. selector: "renderOn:",
  44. fn: function (html){
  45. var self=this;
  46. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6;
  47. $1=_st(html)._h1();
  48. _st($1)._with_(_st(self["@count"])._asString());
  49. $2=_st($1)._yourself();
  50. self["@header"]=$2;
  51. $3=_st(html)._button();
  52. _st($3)._with_("++");
  53. $4=_st($3)._onClick_((function(){
  54. return smalltalk.withContext(function($ctx2) { return _st(self)._increase();
  55. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  56. $5=_st(html)._button();
  57. _st($5)._with_("--");
  58. $6=_st($5)._onClick_((function(){
  59. return smalltalk.withContext(function($ctx2) { return _st(self)._decrease();
  60. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  61. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html}, smalltalk.Counter)})},
  62. messageSends: ["with:", "asString", "h1", "yourself", "button", "onClick:", "increase", "decrease"]}),
  63. smalltalk.Counter);
  64. smalltalk.addMethod(
  65. "_tryExample",
  66. smalltalk.method({
  67. selector: "tryExample",
  68. fn: function (){
  69. var self=this;
  70. return smalltalk.withContext(function($ctx1) { _st(_st(self)._new())._appendToJQuery_(_st("body")._asJQuery());
  71. return self}, function($ctx1) {$ctx1.fill(self,"tryExample",{}, smalltalk.Counter.klass)})},
  72. messageSends: ["appendToJQuery:", "asJQuery", "new"]}),
  73. smalltalk.Counter.klass);