Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="collection of combination operators">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script>
</head>
<body>
<input id="inputA" type="text"><button id="A">A</button>
<input id="inputB" type="text"><button id="B">B</button>
  </body>
</html>
 
const getValue = (id) => document.getElementById(`input${id}`).value
const clickEvent = (id) => Rx.Observable
                             .fromEvent(
                                 document.getElementById(id),'click', ()=> getValue(id)
                             )
const unsubscribe = Rx.Observable
                    .fromEvent(
                      document.getElementById("end"), 'click', ()=> console.log('end clicked')
                    )
const streamA = clickEvent('A');
const streamB = clickEvent('B');
const zip = Rx.Observable.zip(streamA, streamB)
              .subscribe(
                zip => console.log('zip', zip)
              )
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
kkennethleepro
0viewers