We need to give structure to our application with logic and effects. This lessons shows how we can organize our code into two parts: main() function for logic, and effects functions for effects.
// Logic (functional) function main() { return Rx.Observable.timer(0, 1000) .map(i => `Seconds elapsed ${i}`); } // Effects (imperative) function DOMEffect(text$) { text$.subscribe(text => { const container = document.querySelector('#app'); container.textContent = text; }); } function consoleLogEffect(msg$) { msg$.subscribe(msg => console.log(msg)); } const sink = main(); DOMEffect(sink); consoleLogEffect(sink);