I have this sample code:
interval(500).pipe(
throttleTime(1000)
).subscribe(arg => {
console.log(arg);
});
Which emits:
0
3
6
...
I understand that it emits the latest value every 1000 milliseconds. My problem is that it ignores the values that aren't the latest. Is there an operator similar to throttleTime, but one that saves these ignored values? I'd like it to emit:
[0]
[1,2,3]
[4,5,6]
...
Edit: Ideally, I'd like something that listens to clicks of a button. When the first click happens, the code starts a timer for N milliseconds. The user can keep clicking during this time. Once N milliseconds are up, the operator fires with an array holding all of the events that happened during those N milliseconds.
Super-ideally, I'd like the timer to reset everytime the user clicks the button.