Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / src / internal / ReplaySubject.ts
index d6d8eb7dfd3bea416b98ada0c01b2dd279755a1f..7a91bdde807f28ca881385a72fafea025c44c219 100644 (file)
@@ -35,21 +35,23 @@ export class ReplaySubject<T> extends Subject<T> {
   }
 
   private nextInfiniteTimeWindow(value: T): void {
-    const _events = this._events;
-    _events.push(value);
-    // Since this method is invoked in every next() call than the buffer
-    // can overgrow the max size only by one item
-    if (_events.length > this._bufferSize) {
-      _events.shift();
+    if (!this.isStopped) {
+      const _events = this._events;
+      _events.push(value);
+      // Since this method is invoked in every next() call than the buffer
+      // can overgrow the max size only by one item
+      if (_events.length > this._bufferSize) {
+        _events.shift();
+      }
     }
-
     super.next(value);
   }
 
   private nextTimeWindow(value: T): void {
-    this._events.push(new ReplayEvent(this._getNow(), value));
-    this._trimBufferThenGetEvents();
-
+    if (!this.isStopped) {
+      this._events.push(new ReplayEvent(this._getNow(), value));
+      this._trimBufferThenGetEvents();
+    }
     super.next(value);
   }