File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,12 @@ export class ReplaySubject<T> extends Subject<T> {
22
22
_next ( value : T ) : void {
23
23
const now = this . _getNow ( ) ;
24
24
this . events . push ( new ReplayEvent ( now , value ) ) ;
25
+ this . _trimBufferThenGetEvents ( now ) ;
25
26
super . _next ( value ) ;
26
27
}
27
28
28
29
_subscribe ( subscriber : Subscriber < any > ) : Subscription < T > {
29
- const events = this . _getEvents ( this . _getNow ( ) ) ;
30
+ const events = this . _trimBufferThenGetEvents ( this . _getNow ( ) ) ;
30
31
let index = - 1 ;
31
32
const len = events . length ;
32
33
while ( ! subscriber . isUnsubscribed && ++ index < len ) {
@@ -39,7 +40,7 @@ export class ReplaySubject<T> extends Subject<T> {
39
40
return ( this . scheduler || immediate ) . now ( ) ;
40
41
}
41
42
42
- private _getEvents ( now ) : ReplayEvent < T > [ ] {
43
+ private _trimBufferThenGetEvents ( now ) : ReplayEvent < T > [ ] {
43
44
const bufferSize = this . bufferSize ;
44
45
const _windowTime = this . _windowTime ;
45
46
const events = this . events ;
You can’t perform that action at this time.
0 commit comments