1
0

Examples.deploy.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. define("amber_core/Examples", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Canvas"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Examples');
  3. smalltalk.packages["Examples"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('Counter', smalltalk.Widget, ['count', 'header'], 'Examples');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "decrease",
  8. fn: function (){
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) {
  11. self["@count"]=_st(self["@count"]).__minus((1));
  12. _st(self["@header"])._contents_((function(html){
  13. return smalltalk.withContext(function($ctx2) {
  14. return _st(html)._with_(_st(self["@count"])._asString());
  15. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}));
  16. return self}, function($ctx1) {$ctx1.fill(self,"decrease",{},smalltalk.Counter)})},
  17. messageSends: ["-", "contents:", "with:", "asString"]}),
  18. smalltalk.Counter);
  19. smalltalk.addMethod(
  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. smalltalk.method({
  35. selector: "initialize",
  36. fn: function (){
  37. var self=this;
  38. return smalltalk.withContext(function($ctx1) {
  39. smalltalk.Counter.superclass.fn.prototype._initialize.apply(_st(self), []);
  40. self["@count"]=(0);
  41. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Counter)})},
  42. messageSends: ["initialize"]}),
  43. smalltalk.Counter);
  44. smalltalk.addMethod(
  45. smalltalk.method({
  46. selector: "renderOn:",
  47. fn: function (html){
  48. var self=this;
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2,$3,$4,$5,$6;
  51. $1=_st(html)._h1();
  52. _st($1)._with_(_st(self["@count"])._asString());
  53. $2=_st($1)._yourself();
  54. self["@header"]=$2;
  55. $3=_st(html)._button();
  56. _st($3)._with_("++");
  57. $4=_st($3)._onClick_((function(){
  58. return smalltalk.withContext(function($ctx2) {
  59. return self._increase();
  60. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  61. $5=_st(html)._button();
  62. _st($5)._with_("--");
  63. $6=_st($5)._onClick_((function(){
  64. return smalltalk.withContext(function($ctx2) {
  65. return self._decrease();
  66. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  67. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.Counter)})},
  68. messageSends: ["with:", "asString", "h1", "yourself", "button", "onClick:", "increase", "decrease"]}),
  69. smalltalk.Counter);
  70. smalltalk.addMethod(
  71. smalltalk.method({
  72. selector: "tryExample",
  73. fn: function (){
  74. var self=this;
  75. return smalltalk.withContext(function($ctx1) {
  76. _st(self._new())._appendToJQuery_("body"._asJQuery());
  77. return self}, function($ctx1) {$ctx1.fill(self,"tryExample",{},smalltalk.Counter.klass)})},
  78. messageSends: ["appendToJQuery:", "asJQuery", "new"]}),
  79. smalltalk.Counter.klass);
  80. });