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的更多相关文章

  1. rxjs自定义operator

    rxjs自定义operator

  2. [RxJS] Creation operator: of()

    RxJS is a lot about the so-called "operators". We will learn most of the important operato ...

  3. [RxJS] Connection operator: multicast and connect

    We have seen how Subjects are useful for sharing an execution of an RxJS observable to multiple obse ...

  4. [RxJS] Transformation operator: repeat

    Operator repeat() is somewhat similar to retry(), but is not for handling operators. In this lesson ...

  5. [RxJS] Transformation operator: buffer, bufferCount, bufferTime

    This lesson will teach you about another horizontal combination operator: buffer and its variants. B ...

  6. [RxJS] Transformation operator: scan

    All of the combination operators take two or more observables as input. These operators may also be ...

  7. [RxJS] Combination operator: withLatestFrom

    Operator combineLatest is not the only AND-style combinator. In this lesson we will explore withLate ...

  8. [RxJS] Combination operator: combineLatest

    While merge is an OR-style combination operator, combineLatest is an AND-style combination operator. ...

  9. [RxJS] Filtering operator: filter

    This lesson introduces filter: an operator that allows us to let only certain events pass, while ign ...

随机推荐

  1. CentOS6.5 编译安装lnmp环境

    参考:http://54im.com/tag/libmcrypt http://www.educity.cn/linux/1240338.html 设置防火墙,并开启3306 80端口:vi /etc ...

  2. InstallShield:自己备份

    LIST listData;//声明listData listData = ListCreate(STRINGLIST);//创建一个空的实际字符串或数字列表. //参数都是在上个界面中赋值,然后在下 ...

  3. Android中用Application类实现全局变量

    最近在项目中,遇到了application这个类,开始不知道有什么用,经过学习后才知道它的用途也蛮大的,举个例子,如果想在整个应用中使用全局变量,在java中一般是使用静态变量,public类型:而在 ...

  4. print,print_r,echo,var_dump,var_export比较

    print string 1个参数 返回1 语言结构echo 多个string 无返回 语言结构 print_r array 如果想捕捉 print_r() 的输出,可使用 return 参数.若此参 ...

  5. Android Activity 管理

  6. dotnet core开发体验之开始MVC

    开始 在上一篇文章:dotnet core多平台开发体验 ,体验了一把dotnet core 之后,现在想对之前做的例子进行改造,想看看加上mvc框架是一种什么样的体验,于是我就要开始诞生今天的这篇文 ...

  7. 2016 Multi-University Training Contest 2 第一题Acperience

    Acperience Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Probl ...

  8. "The connection for the USB device '###' was unsuccessful. The device is currently in use"

    一.问题描述 1.情景描述 笔者的物理主机系统是“windows7 64位”,想使用“摄像头录像大师”.这个软件在录制视频的过程中,需要调用windows自带的"windows media ...

  9. POJ 2513 Colored Sticks 字典树、并查集、欧拉通路

    Description You are given a bunch of wooden sticks. Each endpoint of each stick is colored with some ...

  10. Spring MVC之@RequestMapping 详解(转)

    引言: 前段时间项目中用到了REST风格来开发程序,但是当用POST.PUT模式提交数据时,发现服务器端接受不到提交的数据(服务器端参数绑定没有加任何注解),查看了提交方式为application/j ...