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>
</head>
<body>
<script src="https://unpkg.com/@reactivex/rxjs@5.0.3/dist/global/Rx.js"></script>
</body>
</html>
 
console.clear();
const { Observable } = Rx;
const source = Observable.interval(100).publish();
source.connect();
// Start with false, change to true after 200ms, then false again
// after another 200ms
const pauser = Observable.timer(200)
  .mapTo(true)
  .concat(Observable.timer(200).mapTo(false))
  .startWith(false);
const pausable = pauser
  .switchMap(paused => (paused ? Observable.never() : source))
  .take(10);
pausable.subscribe(x => console.log(x));
Output

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

Dismiss x
public
Bin info
martypennerpro
0viewers