Skip to content

Instantly share code, notes, and snippets.

@staltz
Created December 10, 2015 18:53
Show Gist options
  • Save staltz/5f01e4581476eee945c4 to your computer and use it in GitHub Desktop.
Save staltz/5f01e4581476eee945c4 to your computer and use it in GitHub Desktop.
Tiny Cycle.js 1
function main() {
return {
DOM: Rx.Observable.timer(0, 1000)
.map(i => `Seconds elapsed ${i}`)
};
}
const drivers = {
DOM: function DOMDriver(sink) {
sink.subscribe(text => {
document.querySelector('#app').textContent = text;
});
}
};
function run(main, drivers) {
const sinks = main();
drivers.DOM(sinks.DOM);
}
run(main, drivers);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment