I'm currently working on simulating typing effects for incoming server messages by adding an interval to the output.
Here's what I have so far:
const stream = interval(1000)
.pipe(
map((): Message => {
return messages.pop();
})
);
this.feed = merge(
stream,
this.local
).pipe(
scan((acc, x) => [...acc, x], [])
);
However, I'm looking to stop the interval once my 'messages' array is empty. I've been trying to implement .TakeWhile without much success. Can anyone offer assistance with this issue?
Thank you in advance.