from

RxJS 5 from

by Echyzen

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/6.2.1/rxjs.umd.js"></script>
<script src="https://rawgit.com/eu81273/jsfiddle-console/master/console.js"></script>

JavaScript

var interval$ = rxjs.interval(1000)
var result$ = interval$.pipe(
	rxjs.operators.mergeMap(x =>
  	x % 2 === 1 ? rxjs.of('a', 'b', 'c') : rxjs.empty()
	)
);

result$.subscribe(x => console.log(x));

// Results in the following to the console:
// x is equal to the count on the interval eg(0,1,2,3,...)
// x will occur every 1000ms
// if x % 2 is equal to 1 print abc
// if x % 2 is not equal to 1 nothing will be output