File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -109,10 +109,14 @@ const noops: Unsubscribe = () => { }
109
109
* @returns {PushObservable<T> } The created push-based observable.
110
110
*/
111
111
export function pushObservable < T > ( initialValue ?: T ) : PushObservable < T > {
112
- let subject : Subject < T > = {
112
+ let subject : Subject < T > = initialValue === undefined ? {
113
113
kind : 'init' ,
114
114
subscribers : new Set ( )
115
- } ;
115
+ } : {
116
+ kind : 'active' ,
117
+ subscribers : new Set ( ) ,
118
+ lastValue : initialValue
119
+ }
116
120
117
121
function handleNext ( value : T ) {
118
122
if ( subject . kind === 'error' || subject . kind === 'complete' ) return ;
@@ -184,10 +188,6 @@ export function pushObservable<T>(initialValue?: T): PushObservable<T> {
184
188
complete : obs . complete ?? noops
185
189
} ) ;
186
190
187
- if ( initialValue !== undefined ) {
188
- obs . next ?.( initialValue ) ;
189
- }
190
-
191
191
break ;
192
192
}
193
193
You can’t perform that action at this time.
0 commit comments