smalltalk.addPackage('Examples', {}); smalltalk.addClass('Counter', smalltalk.Widget, ['count', 'header'], 'Examples'); smalltalk.addMethod( unescape('_increase'), smalltalk.method({ selector: unescape('increase'), category: 'actions', fn: function (){ var self=this; (self['@count']=((($receiver = self['@count']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))); smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [smalltalk.send(self['@count'], "_asString", [])]);})]); return self;}, args: [], source: unescape('increase%0A%20%20%20%20count%20%3A%3D%20count%20+%201.%0A%20%20%20%20header%20contents%3A%20%5B%3Ahtml%20%7C%20html%20with%3A%20count%20asString%5D'), messageSends: [unescape("+"), "contents:", "with:", "asString"], referencedClasses: [] }), smalltalk.Counter); smalltalk.addMethod( unescape('_decrease'), smalltalk.method({ selector: unescape('decrease'), category: 'actions', fn: function (){ var self=this; (self['@count']=((($receiver = self['@count']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]))); smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [smalltalk.send(self['@count'], "_asString", [])]);})]); return self;}, args: [], source: unescape('decrease%0A%20%20%20%20count%20%3A%3D%20count%20-%201.%0A%20%20%20%20header%20contents%3A%20%5B%3Ahtml%20%7C%20html%20with%3A%20count%20asString%5D'), messageSends: [unescape("-"), "contents:", "with:", "asString"], referencedClasses: [] }), smalltalk.Counter); smalltalk.addMethod( unescape('_initialize'), smalltalk.method({ selector: unescape('initialize'), category: 'initialization', fn: function (){ var self=this; smalltalk.send(self, "_initialize", [], smalltalk.Widget); (self['@count']=(0)); return self;}, args: [], source: unescape('initialize%0A%20%20%20%20super%20initialize.%0A%20%20%20%20count%20%3A%3D%200'), messageSends: ["initialize"], referencedClasses: [] }), smalltalk.Counter); smalltalk.addMethod( unescape('_renderOn_'), smalltalk.method({ selector: unescape('renderOn%3A'), category: 'rendering', fn: function (html){ var self=this; (self['@header']=(function($rec){smalltalk.send($rec, "_with_", [smalltalk.send(self['@count'], "_asString", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(html, "_h1", []))); (function($rec){smalltalk.send($rec, "_with_", [unescape("++")]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_increase", []);})]);})(smalltalk.send(html, "_button", [])); (function($rec){smalltalk.send($rec, "_with_", [unescape("--")]);return smalltalk.send($rec, "_onClick_", [(function(){return smalltalk.send(self, "_decrease", []);})]);})(smalltalk.send(html, "_button", [])); return self;}, args: ["html"], source: unescape('renderOn%3A%20html%0A%20%20%20%20header%20%3A%3D%20html%20h1%20%0A%09with%3A%20count%20asString%3B%0A%09yourself.%0A%20%20%20%20html%20button%0A%09with%3A%20%27++%27%3B%0A%09onClick%3A%20%5Bself%20increase%5D.%0A%20%20%20%20html%20button%0A%09with%3A%20%27--%27%3B%0A%09onClick%3A%20%5Bself%20decrease%5D'), messageSends: ["with:", "asString", "yourself", "h1", "onClick:", "increase", "button", "decrease"], referencedClasses: [] }), smalltalk.Counter);