diff --git a/src/internal/ReplaySubject.ts b/src/internal/ReplaySubject.ts index 85f5c71d60..69cc69e64b 100644 --- a/src/internal/ReplaySubject.ts +++ b/src/internal/ReplaySubject.ts @@ -65,6 +65,12 @@ export class ReplaySubject extends Subject { super.next(value); } + public clearBuffer() { + // clears the event buffer so that new subscribers do not receive events which have been + // added to the buffer before this method was called. + this._events = []; + } + /** @internal */ protected _subscribe(subscriber: Subscriber): Subscription { this._throwIfClosed();