JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/@reactivex/rxjs@5.2.0/dist/global/Rx.js"></script>
<h1>快速點擊我,看 console</h1>
CSS
html, body {
height: 100%;
background-color: tomato;
}
JavaScript
var click = Rx.Observable.fromEvent(document, 'click');
var source = Rx.Observable.interval(1000);
var example = click.window(source)
example
.map(innerObservable => innerObservable.count())
.switch()
.subscribe(console.log);