Creates a buffered observable with an empty buffer.
Maximum number of values kept in the buffer. When exceeded, the oldest value is dropped.
OptionalonDrop: (count: number) => void
Called on BufferedObservable.unbuffer with the number of values that were dropped because the buffer was full, if any.
ProtectedaddAdds observer to the observer list, triggering onFirstSubscribe if it is the first one.
The observer to add.
Buffers data (dropping the oldest value if the buffer is full), then notifies current
observers synchronously.
Value passed to each observer.
ProtectedremoveRemoves observer from the observer list, calling the teardown returned by
onFirstSubscribe if it was the last one.
The observer to remove.
Registers observer. Buffered values are replayed to it in a microtask, after which it
receives new values as they are notified. Unsubscribing during the replay stops it.
Values notified between this call and the replay microtask are delivered through the buffer. Once BufferedObservable.unbuffer has run, nothing is buffered anymore, so such values are not delivered to the new observer.
Function called with each buffered and subsequently notified value.
A Subscription to stop receiving notifications.
Drop buffered data and don't buffer future data. This is to avoid leaking memory when it's not needed anymore. This can be seen as a performance optimization, and things will work probably even if this method isn't called, but still useful to clarify our intent and lowering our memory impact.
An Observable that keeps a bounded history of notified values and replays it to each new observer.
This lets late subscribers (e.g. a component started after SDK initialization) receive values notified before they subscribed. Once every interested party has subscribed, call BufferedObservable.unbuffer to release the buffer.