JSFiddle - React, Tailwind, and code Playground

by mizobata

HTML

<script src="https://unpkg.com/rxjs/bundles/rxjs.umd.min.js"></script>

<button id="hello-btn">Hello</button>

JavaScript

const {fromEvent} = rxjs
const {operators} = rxjs

const btn = document.getElementById('hello-btn')

const sayHelloClick$ = fromEvent(btn, 'click')

sayHelloClick$.pipe(
  operators.filter(e => e.shiftKey)
).subscribe(e => alert('hello shift key!'))

sayHelloClick$.subscribe(e => alert('hello!'))