RxSwift

作者: aa3d1c0d483c | 来源:发表于2022-12-12 17:44 被阅读0次

一.可监听序列

PublishSubject、BehaviorSubject、ReplaySubject三者既可以做监听者也可做观察者,区别在于重写订阅后是否能收到之前的订阅事件,PublishSubject只能收到订阅后的事件,BehaviorSubject能收到默认事件或新的事件,ReplaySubject能收到缓存的多个事件。BehaviorRelay只做可监听序列,事件的发出用accept。

二.观察者

三.操作符

0.from repeatelement  just single never empty error

1. delay groupby withlatestfrom 取最新序列

2. combinelatest/zip  组合两列元素

startwith/concat/merage  拼接或者合并

reduce scan 函数调用

elementAt filter take takeLast  takeUntil  takeWhile 取出符合条件的元素

ignoreElements debounce distinctUntilChanged skip  skipUntil  skipWhile    忽略元素

map flatMap flatMaplatest 转换同时降维度

 3. do delaysubscription

4.obseveron/subscribeon

5. catcherror retry

其他:amb buffer  connect  deferred  dematerialize/materialize interval publish refCount replay

相关文章

网友评论

      本文标题:RxSwift

      本文链接:https://www.haomeiwen.com/subject/ddlcqdtx.html