2
0

Examples.deploy.js 2.9 KB

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