Lamp

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

A working example

Source code

live
<html>
<script src="https://cdn.jsdelivr.net/npm/lemonadejs@3/dist/lemonade.js"></script>
<div id='root'></div>
<script>
function Lamp() {
    const self = this;
    return `<>
        <img src="/img/example-lamp-{{self.state?'on':'off'}}.jpg">
        <br/>
        <input type="button" onclick="self.state = 1" value="Light on" />
        <input type="button" onclick="self.state = 0" value="Light off" />
    </>`;
}
lemonade.render(Lamp, document.getElementById('root'));
</script>
</html>

See this example on codesandbox