1
0

Examples.deploy.js 3.0 KB

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