From 2e294ea1019fa7e18a8a18865034ef11e9a6c0aa Mon Sep 17 00:00:00 2001 From: Charles Crossan Date: Wed, 6 Oct 2021 15:01:13 -0400 Subject: [PATCH] Add clearBuffer method to ReplaySubject --- src/internal/ReplaySubject.ts | 6 ++++++ 1 file changed, 6 insertions(+) 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();