gpt4 book ai didi

rxjs - 任何需要先取消订阅 RxJS()

转载 作者:行者123 更新时间:2023-12-04 05:28:31 25 4
gpt4 key购买 nike

在以下代码中:-

RxJS.Observable.of(1,2).first().subscribe((x) => console.log(x););

给定运营商 first() 是否有必要取消订阅?

最佳答案

不会。调用first()后自动退订.当前语法是 observable.pipe(first()).subscribe(func);对于 RxJS 6。
documentation状态:

If called with no arguments, first emits the first value of the source Observable, then completes.

关于rxjs - 任何需要先取消订阅 RxJS(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49683600/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com