Last active
August 29, 2015 14:16
-
-
Save jaredly/585cfe0298c62745ce6f to your computer and use it in GitHub Desktop.
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
| let btn = $('button')[0] | |
| let clicks = Rx.Observable.fromEvent(btn, 'click') | |
| clicks.subscribe(value => console.log('clicked!')) | |
| let values = clicks.map(() => Math.floor(Math.random() * 10 + 2)) | |
| let less1 = values.map(value => value - 1) | |
| let times2 = less1.map(value => value*2) | |
| times2.subscribe(value => console.log('i got a value', value)) | |
| times2.subscribe(value => console.log('also subscribing', value)) | |
| values.subscribe(value => console.log('the original was', value)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment