define("amber_core/Examples", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals"], function(smalltalk,nil,_st, globals){ smalltalk.addPackage('Examples'); smalltalk.packages["Examples"].transport = {"type":"amd","amdNamespace":"amber_core"}; smalltalk.addClass('Counter', globals.nil, ['count', 'header'], 'Examples'); smalltalk.addMethod( smalltalk.method({ selector: "decrease", protocol: 'actions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { self["@count"]=_st(self["@count"]).__minus((1)); _st(self["@header"])._contents_((function(html){ return smalltalk.withContext(function($ctx2) { return _st(html)._with_(_st(self["@count"])._asString()); }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})})); return self}, function($ctx1) {$ctx1.fill(self,"decrease",{},globals.Counter)})}, args: [], source: "decrease\x0a count := count - 1.\x0a header contents: [:html | html with: count asString]", messageSends: ["-", "contents:", "with:", "asString"], referencedClasses: [] }), globals.Counter); smalltalk.addMethod( smalltalk.method({ selector: "increase", protocol: 'actions', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { self["@count"]=_st(self["@count"]).__plus((1)); _st(self["@header"])._contents_((function(html){ return smalltalk.withContext(function($ctx2) { return _st(html)._with_(_st(self["@count"])._asString()); }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})})); return self}, function($ctx1) {$ctx1.fill(self,"increase",{},globals.Counter)})}, args: [], source: "increase\x0a count := count + 1.\x0a header contents: [:html | html with: count asString]", messageSends: ["+", "contents:", "with:", "asString"], referencedClasses: [] }), globals.Counter); smalltalk.addMethod( smalltalk.method({ selector: "initialize", protocol: 'initialization', fn: function (){ var self=this; return smalltalk.withContext(function($ctx1) { self._initialize(); self["@count"]=(0); return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Counter)})}, args: [], source: "initialize\x0a super initialize.\x0a count := 0", messageSends: ["initialize"], referencedClasses: [] }), globals.Counter); smalltalk.addMethod( smalltalk.method({ selector: "renderOn:", protocol: 'rendering', fn: function (html){ var self=this; return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6; $1=_st(html)._h1(); _st($1)._with_(_st(self["@count"])._asString()); $ctx1.sendIdx["with:"]=1; $2=_st($1)._yourself(); self["@header"]=$2; $3=_st(html)._button(); $ctx1.sendIdx["button"]=1; _st($3)._with_("++"); $ctx1.sendIdx["with:"]=2; $4=_st($3)._onClick_((function(){ return smalltalk.withContext(function($ctx2) { return self._increase(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})); $ctx1.sendIdx["onClick:"]=1; $5=_st(html)._button(); _st($5)._with_("--"); $6=_st($5)._onClick_((function(){ return smalltalk.withContext(function($ctx2) { return self._decrease(); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})); return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.Counter)})}, args: ["html"], source: "renderOn: html\x0a header := html h1 \x0a\x09with: count asString;\x0a\x09yourself.\x0a html button\x0a\x09with: '++';\x0a\x09onClick: [self increase].\x0a html button\x0a\x09with: '--';\x0a\x09onClick: [self decrease]", messageSends: ["with:", "h1", "asString", "yourself", "button", "onClick:", "increase", "decrease"], referencedClasses: [] }), globals.Counter); });