Created
March 29, 2018 02:46
-
-
Save B3nnyL/2913b3bba56179e9c0b2e01b003f322f to your computer and use it in GitHub Desktop.
Rxjs-playground
This file contains 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
//Click monster | |
var button = document.querySelector('button'); | |
Rx.Observable.fromEvent(button, 'click') | |
.scan(count => count + 1, 0) | |
.subscribe(count => console.log(`Clicked ${count} times`)); |
This file contains 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
//click and pop | |
var button = document.querySelector('button'); | |
Rx.Observable.fromEvent(button, 'click') | |
.subscribe(() => console.log('Clicked!')); | |
//get the style of paragraphy when hovering over it. | |
var para = document.querySelector('p'); | |
Rx.Observable.fromEvent(para, 'mouseover') | |
.subscribe(() => console.log(para.style.getPropertyValue('font-size'))); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment