@@ -113,14 +113,14 @@ class WindowTimeSubscriber<T> extends Subscriber<T> {
113
113
private windowCreationInterval : number ,
114
114
private scheduler : IScheduler ) {
115
115
super ( destination ) ;
116
+
117
+ const window = this . openWindow ( ) ;
116
118
if ( windowCreationInterval !== null && windowCreationInterval >= 0 ) {
117
- let window = this . openWindow ( ) ;
118
119
const closeState : CloseState < T > = { subscriber : this , window, context : < any > null } ;
119
120
const creationState : CreationState < T > = { windowTimeSpan, windowCreationInterval, subscriber : this , scheduler } ;
120
121
this . add ( scheduler . schedule ( dispatchWindowClose , windowTimeSpan , closeState ) ) ;
121
122
this . add ( scheduler . schedule ( dispatchWindowCreation , windowCreationInterval , creationState ) ) ;
122
123
} else {
123
- let window = this . openWindow ( ) ;
124
124
const timeSpanOnlyState : TimeSpanOnlyState < T > = { subscriber : this , window, windowTimeSpan } ;
125
125
this . add ( scheduler . schedule ( dispatchWindowTimeSpanOnly , windowTimeSpan , timeSpanOnlyState ) ) ;
126
126
}
@@ -174,7 +174,7 @@ class WindowTimeSubscriber<T> extends Subscriber<T> {
174
174
function dispatchWindowTimeSpanOnly < T > ( this : Action < TimeSpanOnlyState < T > > , state : TimeSpanOnlyState < T > ) : void {
175
175
const { subscriber, windowTimeSpan, window } = state ;
176
176
if ( window ) {
177
- window . complete ( ) ;
177
+ subscriber . closeWindow ( window ) ;
178
178
}
179
179
state . window = subscriber . openWindow ( ) ;
180
180
this . schedule ( state , windowTimeSpan ) ;
0 commit comments