根据文档,它exhaustMap
使用 ResultSelector,这将在 V8 中删除。我尝试遵循该示例,但无法找到如何重构我的代码的线索。
interval(5000)
.pipe(
takeWhile(() => !this.isDialogDestroyed),
exhaustMap(() => this.versService.checkStatus(myParameters))
)
.subscribe({
next: (status) => {
if (status === 'DONE') {
this.isDialogDestroyed = true;
// ... further processing - removed for simplicity
}
},
error: () => {
// Handle errors here
},
});
如何调整代码以适应 V8?
因为您自己没有使用结果选择器( 的第二个参数
exhaustMap
),所以您无需执行任何操作即可使该代码在 V8 中兼容。在您的示例中,您可以看到他们提出的建议是将结果中的第二个参数替换
switchMap
为管道 a :map
如果我们检查操作员的文档
exhaustMap
:第二个参数
resultSelector?: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R
将被删除,因此不要使用它。由于您粘贴的代码片段没有使用它,因此您无需采取任何操作:)