startWith - 3

RxJS 5 startWith

by Brian Troncone

HTML

<script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.umd.js"></script>

JavaScript

//emit values in sequence every 1s
const source = Rx.Observable.interval(1000);
//start with -3, -2, -1
const example = source.startWith(-3, -2, -1);
//output: -3, -2, -1, 0, 1, 2....
const subscribe = example.subscribe(val => console.log(val));