Documentation - v7.17.0
    Preparing search index...

    Class BufferedObservable<T>

    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.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index
    observers: Observer<T>[] = []

    Observers currently subscribed, in subscription order.

    • 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.

      Parameters

      • observer: Observer<T>

        Function called with each buffered and subsequently notified value.

      Returns Subscription

      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.

      Returns void