0.5.0 • Published 6 years ago
reactive-lens v0.5.0
const store = Store.init({left: '', right: ''})
function Input(store: Store<string>) { const input = document.createElement('input') input.value = store.get() store.on(x => input.value = x) input.addEventListener('input', function () { store.set(this.value) }) }
const body = document.getElementsByTagName('body')0 body.appendChild(Input(store.at('left'))) body.appendChild(Input(store.at('right')))