Created
April 3, 2016 19:16
-
-
Save anonymous/f68f72924bcb8932d4a17a9de880d3b3 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/holurom
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.6/rx.all.js"></script> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <div id="app"></div> | |
| <script id="jsbin-javascript"> | |
| 'use strict'; | |
| function main() { | |
| return Rx.Observable.timer(0, 1000) // | |
| .map(function (i) { | |
| return 'Seconds elapsed ' + i; | |
| }); | |
| } | |
| function DONEffect(text$) { | |
| text$.subscribe(function (text) { | |
| var container = document.querySelector('#app'); | |
| container.textContent = text; | |
| }); | |
| } | |
| function consoleLogEffect(msg$) { | |
| msg$.subscribe(function (msg) { | |
| return console.log(msg); | |
| }); | |
| } | |
| var sink = main(); | |
| DONEffect(sink); | |
| consoleLogEffect(sink); | |
| </script> | |
| <script id="jsbin-source-javascript" type="text/javascript">function main(){ | |
| return Rx.Observable.timer(0, 1000) // | |
| .map(i => `Seconds elapsed ${i}`); | |
| } | |
| function DONEffect(text$){ | |
| text$.subscribe(text => { | |
| const container = document.querySelector('#app'); | |
| container.textContent = text; | |
| }); | |
| } | |
| function consoleLogEffect(msg$){ | |
| msg$.subscribe(msg => console.log(msg)) | |
| } | |
| const sink = main(); | |
| DONEffect(sink); | |
| consoleLogEffect(sink); | |
| </script></body> | |
| </html> |
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
| 'use strict'; | |
| function main() { | |
| return Rx.Observable.timer(0, 1000) // | |
| .map(function (i) { | |
| return 'Seconds elapsed ' + i; | |
| }); | |
| } | |
| function DONEffect(text$) { | |
| text$.subscribe(function (text) { | |
| var container = document.querySelector('#app'); | |
| container.textContent = text; | |
| }); | |
| } | |
| function consoleLogEffect(msg$) { | |
| msg$.subscribe(function (msg) { | |
| return console.log(msg); | |
| }); | |
| } | |
| var sink = main(); | |
| DONEffect(sink); | |
| consoleLogEffect(sink); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment