Created
December 10, 2015 18:53
-
-
Save staltz/5f01e4581476eee945c4 to your computer and use it in GitHub Desktop.
Tiny Cycle.js 1
This file contains 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
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