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>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var counter = 0;
var respond = 4
var observable = Rx.Observable
    .create(observable => {
      if(counter == respond) {
        observable.onNext('response');
        observable.onCompleted();                  
      } else {
        observable.onError('error');
        counter++; 
      }
    })
    .retry(respond + 1);
observable.subscribe(value => console.log(value),
                     error => console.log(error));
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers