Skip to content

Instantly share code, notes, and snippets.

@staltz
Created December 10, 2015 19:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staltz/23950c227d4a2b308bbf to your computer and use it in GitHub Desktop.
Save staltz/23950c227d4a2b308bbf to your computer and use it in GitHub Desktop.
Tiny Cycle.js 0
Rx.Observable.timer(0, 1000)
.map(i => `Seconds elapsed ${i}`)
.subscribe(text => {
const container = document.querySelector('#app');
container.textContent = text;
});
function main() {
return {
DOM: Rx.Observable.timer(0, 1000)
.map(i => `Seconds elapsed ${i}`)
}
}
function DOMSideEffect(text$) {
text$.subscribe(text => {
const container = document.querySelector('#app');
container.textContent = text;
});
}
DOMSideEffect(main().DOM);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment