Rxjs 6 merge

Get element id

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/6.6.7/rxjs.umd.js"></script>
<button id="button-one">Button 1</button>
<button id="button-two">Button 2</button>

JavaScript

const buttonOne = document.getElementById('button-one');
const buttonTwo = document.getElementById('button-two');

const listener = rxjs.merge(
  rxjs.fromEvent(buttonOne, 'click'),
  rxjs.fromEvent(buttonTwo, 'click')
);
const subscription = listener.subscribe(e => {
  console.log('clicked id: ', e.target.id);
});