Created
December 10, 2015 19:59
-
-
Save staltz/23950c227d4a2b308bbf to your computer and use it in GitHub Desktop.
Tiny Cycle.js 0
This file contains hidden or 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
Rx.Observable.timer(0, 1000) | |
.map(i => `Seconds elapsed ${i}`) | |
.subscribe(text => { | |
const container = document.querySelector('#app'); | |
container.textContent = text; | |
}); |
This file contains hidden or 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}`) | |
} | |
} | |
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