[RxJS] Utility operator: do
We just saw map which is a transformation operator. There are a couple of categories of operators, such as filtering, combination, flattening, etc. One of these categories is the utility operators. The most important utility operator is do
, useful for debugging.
var foo = Rx.Observable.interval(200).take(4); /*
foo: ---0---1---2---3--...
do(x => console.log('before ' + x))
---0---1---2---3--...
map(x => x * 2)
---0---2---4---6--...
do(x => console.log('after ' + x))
---0---2---4---6--...
*/ var bar = foo
.do(x => console.log('before ' + x))
.map(x => x * 2)
.do(x => console.log('after ' + x)); bar.subscribe(
function (x) { console.log('next ' + x); },
function (err) { console.log('error ' + err); },
function () { console.log('done'); },
);
[RxJS] Utility operator: do的更多相关文章
- rxjs自定义operator
rxjs自定义operator
- [RxJS] Creation operator: of()
RxJS is a lot about the so-called "operators". We will learn most of the important operato ...
- [RxJS] Connection operator: multicast and connect
We have seen how Subjects are useful for sharing an execution of an RxJS observable to multiple obse ...
- [RxJS] Transformation operator: repeat
Operator repeat() is somewhat similar to retry(), but is not for handling operators. In this lesson ...
- [RxJS] Transformation operator: buffer, bufferCount, bufferTime
This lesson will teach you about another horizontal combination operator: buffer and its variants. B ...
- [RxJS] Transformation operator: scan
All of the combination operators take two or more observables as input. These operators may also be ...
- [RxJS] Combination operator: withLatestFrom
Operator combineLatest is not the only AND-style combinator. In this lesson we will explore withLate ...
- [RxJS] Combination operator: combineLatest
While merge is an OR-style combination operator, combineLatest is an AND-style combination operator. ...
- [RxJS] Filtering operator: filter
This lesson introduces filter: an operator that allows us to let only certain events pass, while ign ...
随机推荐
- javascript删除目标标签
<script> window.onload=function(){ var odiv=document.getElementById("content"); // ...
- 软件测试software testing summarize
软件测试(英语:software testing),描述一种用来促进鉴定软件的正确性.完整性.安全性和质量的过程.软件测试的经典定义是:在规定的条件下对程序进行操作,以发现程序错误,衡量软件质量,并对 ...
- 写了几天的博客-feel
写博客 真的总结我自己的知识.长见识了.记录下自己遇到的东西,算是一个总结,有问题了,还可以回头看一下.很好 真的很好.
- css3 3D盒子效果
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- 趣味C程序100.1 .1 绘制余弦曲线
说明:1.本问题来源于<C语言经典.趣味.实用程序设计编程百例精解>,所有程序为本人自己编写.与原程序不同之处作有标记. 2.本系列所有程序均使用codeblocks编译,操作系统为Win ...
- word的不同章节之间添加不同的页眉
1.点击空百处 2. 在页面布局中,找到分隔符,选择”连续“选项,即在空白处插入分隔符 特别注意:这里分隔符会出现换行现象,请选择空白处,不要影响原先布局 3. 当编辑下一个页眉时,点击“链接到前一条 ...
- hadoop 常用配置项
core-site.xml name value Description fs.default.name hdfs://hadoopmaster:9000 定义HadoopMaster的URI ...
- tyvj 1150 绳子围点 Pick定理 防溢出策略
P1150 - 绳子围点 From 332404521 Normal (OI)总时限:10s 内存限制:128MB 代码长度限制:64KB 背景 Background 最近小小鱼在研 ...
- Phonegap 3.0 获取当前地址位置
新版本的cordova 3.0 中,使用官方的示例可直接获取当前手机的地理位置,前提是手机开启了gps,或可联网. 获取到的是经纬度坐标值等信息,可通过google api 实现通过经纬度获取当前地理 ...
- eclipse下切换svn用户
在eclipse中经常用到用svn进行代码版本控制,为了提交或更新代码的时候不反复地提示我们输入用户名和密码,于是我们就习惯把访问SVN的用户名密码自动保存起来.以便下次自动使用,不要再次手工输入,但 ...