Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://unpkg.com/rxjs@5.0.3/bundles/Rx.min.js"></script>
</head>
<body>
</body>
</html>
 
const Observable = Rx.Observable;
function mockHTTPRequest(id) {
  return Observable.of(id).delay(100);
}
let parameter1 = 'a';
let parameter2 = false; 
let sources = [
  parameter1 ? mockHTTPRequest('rest/fillin/ids/' + parameter1) : Observable.of(null),
  parameter2 ? mockHTTPRequest('rest/textitem/ids/' + parameter2) : Observable.of(null)
];
Observable.forkJoin(...sources)
  .map(data => {
    console.log(data.length);
    return data;
  })
  .subscribe(values => console.log(values));
Output

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

Dismiss x
public
Bin info
martinsikpro
0viewers