Lamp

A LemonadeJS {self} property value will be synchronized with the HTML attribute.

A working example



Source code


<html>
<script src="https://lemonadejs.net/v3/lemonade.js"></script>
<div id='root'></div>
<script>
function Lamp() {
    const self = this;
    return `<>
        <img src="/templates/default/img/example-lamp-{{self.state?'on':'off'}}.jpg">
        <br/>
        <button onclick="self.state = 1">Light on</button>
        <button onclick="self.state = 0">Light off</button>
    </>`;
}
lemonade.render(Lamp, document.getElementById('root'));
</script>
</html>

See this example on codesandbox