Skip to content

Instantly share code, notes, and snippets.

@kyleparisi
Created February 9, 2017 14:23
Show Gist options
  • Save kyleparisi/6a0598ce12f41615891ba0662ab4d4cf to your computer and use it in GitHub Desktop.
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)
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