Counter
Simple counter using LemonadeJS.
Example
See this example on codesandbox
Source code
<html>
<script src="https://lemonadejs.com/v2/lemonade.js"></script>
<div id='root'></div>
<script>
var Counter = (function() {
var self = {
count: 0
};
self.add = function() {
self.count++;
}
self.remove = function() {
self.count--;
}
self.reset = function(element) {
self.count = 0;
}
var template = `
<div class="counter">
<h1>Count {{self.count}}</h1>
<div>
<button onclick="self.add()" class="jbutton dark">+</button>
<button onclick="self.remove()" class="jbutton dark">-</button>
<button onclick="self.reset()" class="jbutton dark">Reset</button>
</div>
</div>
`;
return lemonade.element(template, self);
});
lemonade.render(Counter, document.getElementById('root'));
</script>
</html>