Looking to find the variance in emissions from a single Observable.
Is it possible to access both the current and previous emission of an Observable when it emits a new value? I'm envisioning something like this:
ob$.subscribe(val => {
console.log(val)
// First emission: [1,2,3]
// Second emission: [1,2,3,4]
console.log(findDifference(before, after)) // [4]
})
How can this be achieved? Do I have to keep track of each emission in a higher-level variable or is there a clever RxJS method for accomplishing this?