为什么flatMap导致下游减少触发?RxJS减少不会继续
我有这样的代码:
handleFiles.flatMap(files =>
Rx.Observable.from(files).
flatMap((file, i) => fileReader(file, i)).
reduce((form, file, i) => {
form.append('file[' + i + ']', result);
console.log('reduce step', file);
return form;
}, new FormData()).
tap(console.log.bind(console, 'after reduce'))
).
subscribe(console.log.bind(console, 'response'));
而问题是,“减少后”水龙头从来没有击中。为什么?
日志是这样的:
截图:
文件是一个JS数组,简单明了。我添加了一个截图。我之前已经扫描过,但确实工作...但是因为它是一个JS数组聚合应该做onComplete,对吧? – Henrik
然而,这是一个很好的结果。我发现我的错误;没有完成fileReader中的主题。咄! – Henrik