Created
February 9, 2017 14:23
-
-
Save kyleparisi/6a0598ce12f41615891ba0662ab4d4cf to your computer and use it in GitHub Desktop.
Prototype of how to use lindy in a reactive setting (lindy modified slightly)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let init = lindy('h3', `Service running - false`); | |
let start = function () { | |
return lindy('button', { | |
onclick: () => this.emit('running', true) | |
}, 'Start Service'); | |
}; | |
let stop = function () { | |
return lindy('button', { | |
onclick: () => this.emit('running', false) | |
}, 'Stop Service') | |
}; | |
let root = lindy('div', [ | |
init, | |
start, stop, | |
function () { | |
this.on('running', running => init.innerHTML = `Service running - ${running.toString()}`) | |
} | |
]); | |
document.body.appendChild(root); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment