niedziela, 30 czerwca 2019

Programming exercise #6 - start emitting value, when all items emits something [rxjs]

So, new RXJS exercise:
Create two buttons like this:
const button1 = document.querySelector('#btn1');
const button2 = document.querySelector('#btn2');

After click on every button emit some value, but start doing this only, when user click both first and second button. When this rule is satisfied, emit last value.

Programming exercise #5 - Merge multiple observables (RXJS)

Today programming exercise:

You have two buttons on website like this:
<button id="btn1">Button1</button>
<button id="btn2">Button2</button>
Subscribe to click event on those two buttons and on every click, emit text "button 1" or "button 2". Use merge method, to create one observable from two.

You can also create two intervals, that emits some value, and merge them into one observable.