Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.6/rx.all.js"></script>
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
  <title>JS Bin</title>
  <script src="//cdn.jsdelivr.net/rsvp/3.0.6/rsvp.js"></script>
</head>
<body>
  <input id="input" type="text">
</body>
</html>
 
/* Have staggering intervals */
var source1 = Rx.Observable.interval(100)
    .map(i => `First: ${i}`);
var source2 = Rx.Observable.interval(150)
    .map(i => `Second: ${i}`);
// Combine latest of source1 and source2 whenever either gives a value
var source = Rx.Observable.combineLatest(
        source1,
        source2
    ).take(4);
var subscription = source.subscribe(
  x => console.log(`onNext: ${x}`),
  e => console.log(`onError: ${e}`),
  () => console.log('onCompleted'));
// => onNext: First: 0, Second: 0
// => onNext: First: 1, Second: 0
// => onNext: First: 1, Second: 1
// => onNext: First: 2, Second: 1
// => onCompleted
Output

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

Dismiss x
public
Bin info
dstoyanovpro
0viewers