[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 ...
随机推荐
- Gvim7.4简单配置
今天下午小折腾了一会Gvim编辑器(7.4版,目前最新).看起来高端又没有代码提示,还能锻炼锻炼记忆. 修改了下默认启动配置<修改后如下图>: 打开编辑器: 编辑->启动设定-> ...
- iOS: 学习笔记, Swift与C指针交互(译)
Swift与C指针交互 Objective-C和C API经常需要使用指针. 在设计上, Swift数据类型可以自然的与基于指针的Cocoa API一起工作, Swift自动处理几种常用的指针参数. ...
- 解决VS2015无法调试dotnet core项目
dotnet core 1.0正式版和VS2015 update3安装后一直无法在VS中正常调试. 错误提示:The debugger's worker process (msvsmon.exe) u ...
- ASP.NET MVC 中使用JavaScriptResult
在浏览器地址栏输入地址,在页面上想通过脚本弹出一个框,看到Controller下有个JavaScript方法,返回的类型是JavaScriptResult,于是想用这个方法弹出框, public Ac ...
- bzoj 2733: [HNOI2012]永无乡 离线+主席树
2733: [HNOI2012]永无乡 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 1167 Solved: 607[Submit][Status ...
- 听同事讲 Bayesian statistics: Part 1 - Bayesian vs. Frequentist
听同事讲 Bayesian statistics: Part 1 - Bayesian vs. Frequentist 摘要:某一天与同事下班一同做地铁,刚到地铁站,同事遇到一熟人正从地铁站出来. ...
- 试试Navicat和Axere RP Pro吧
感觉在作头作起和沟通方面,这些东东真是提高不好效率呢~~~ 由于敏感,只作载图.
- WINDOWS+L组合键锁定XP
在Windows XP时工作时,我们经常要锁定计算机,当计算机被锁定后,只有重新登录才能够使用计算机,从而保证了计算机的安全. WINDOWS+L组合键锁定XP,就是键盘上右边的小窗口+L键 ,可以快 ...
- DOS - COPY
copy,中文含义为"复制",一个很容易见名知意的命令,它的作用是复制文件,用法十分简单:copy 源文件 目的路径. 假设,你需要把d:\test\test.txt这个文件复 ...
- 【转】VMware 11安装Mac OS X 10.10 及安装Mac Vmware Tools.
原文网址:http://www.cnblogs.com/Anand/p/4483727.html 先上一张效果图兴奋一下,博主穷屌丝一个,只能通过虚拟黑苹果体验下高富帅的生活,感觉超爽的,废话不多说的 ...