Open derekstavis opened 7 years ago
I have been trying some code snippets at node REPL and I've stumbled into an issue with Observable.generate usage.
Observable.generate
The following snippet works:
rx.Observable.generate( { v: 1 }, o => o.v < 100, o => ({ v: o.v + 1 }), o => o ).subscribe( console.log.bind(null, 'next'), console.log.bind(null, 'error'), console.log.bind(null, 'completed') )
When adding Promises, the analogous works partially:
Promises
rx.Observable.generate( { v: 1 }, o => o.v < 100, o => Promise.resolve({ v: o.v + 1 }), o => o ).subscribe( console.log.bind(null, 'next'), console.log.bind(null, 'error'), console.log.bind(null, 'completed') )
With the observable finishing with a single next before receiving the completed callback.
next
completed
Is it by design that Promises finish the generate observable?
generate
Thanks!
I have been trying some code snippets at node REPL and I've stumbled into an issue with
Observable.generate
usage.The following snippet works:
When adding
Promises
, the analogous works partially:With the observable finishing with a single
next
before receiving thecompleted
callback.Is it by design that Promises finish the
generate
observable?Thanks!