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>
Is it possible to "foresee the future" and get the same data
array without waiting 2 seconds?
To clarify, I'm trying to find a way to wrap somehow a given Observable (obs$
in the example above) with a custom timer/scheduler so I could get the events immediately.