I'm collecting all the events of an Observable to a data
array:
const obs$ = Rx.Observable
.interval(500)
.take(4);
let data = [];
const start = performance.now();
obs$.subscribe(
value => {
data.push({
time: performance.now() - start,
data: value
});
},
() => {},
() => {
console.log(JSON.stringify(data, null, 2));
}
);
<script src="https://unpkg.com/rxjs@5.2.0/bundles/Rx.js"></script>
See Question&Answers more detail:os