RxJS - take n last elements from an observable
问题 I want to take 3 last elements from an observable. Let's say that my timeline looks like this: --a---b-c---d---e---f-g-h-i------j-> where: a, b, c, d, e, f, g, h, i, j are emitted values Whenever a new value is emitted I want to get it immediately, so it can look like this: [a] [a, b] [a, b, c] [b, c, d] [c, d, e] [d, e, f] [e, f, g] [f, g, h] ... and so on I think that this is super useful. Imagine building a chat where you want to display 10 last messages. Whenever a new message comes you