To help understand your stream, you’ll almost always want to log out some the intermediate values to see how it has progressed during its lifespan. This lesson teaches you how to use do to log values in the middle of the stream without having an impact on the rest of the stream.

Observable.combineLatest(
timer$.do((x)=> console.log(x)),
input$.do((x)=> console.log(x)),
(timer, input)=> ({count: timer.count, text: input})
)
.takeWhile((data)=> data.count <= )
.filter((data)=> data.count === parseInt(data.text))
.do(()=>{console.log("score!!")})
.reduce((acc, curr)=> acc + , )
.subscribe(
(x)=> console.log(x),
err=> console.log(err),
()=> console.log('complete')
);

We put servel do() block in the code, it doesn't affect any logic, just simply loggout what we want to see, so it is good when we want to debug the stream.

[RxJS] Logging a Stream with do()的更多相关文章

  1. [RxJS] Toggle A Stream On And Off With RxJS

    This lesson covers how to toggle an observable on and off from another observable by showing how to ...

  2. [RxJS] Stopping a Stream with TakeUntil

    Observables often need to be stopped before they are completed. This lesson shows how to use takeUnt ...

  3. [RxJS] Starting a Stream with SwitchMap & switchMapTo

    From an event map to another event we can use switchMap(), switchMap() accept an function which retu ...

  4. [RxJS] Completing a Stream with TakeWhile

    Subscribe can take three params: subscribe( (x)=> console.log(x), err=> console.log(err), ()=& ...

  5. python logging colorlog

    import logging LOG_LEVEL = logging.NOTSET LOGFORMAT = "[%(log_color)s%(levelname)s] [%(log_colo ...

  6. python日志模块---logging

    1.将日志打印到屏幕 import logging logging.debug('This is debug message---by liu-ke') logging.info('This is i ...

  7. python logging模块 basicConfig配置文件

    logging.basicConfig(level=log_level, format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s ...

  8. python中利用logging包进行日志记录时的logging.level设置选择

    之前在用python自带的logging包进行日志输出的时候发现有些logging语句没有输出,感到比较奇怪就去查了一下logging文档.然后发现其在设置和引用时的logging level会影响最 ...

  9. logging

    #coding=utf8 import sys, logging   logging.basicConfig(level=logging.INFO,                     forma ...

随机推荐

  1. java单例模式(两种常用模式)

    单例模式是java中常见的设计模式 特点: 单例类只能有一个实例 单例类必须自己创建自己的唯一实例 单例类必须给所有的其他对象提供这一实例 单例模式是某个类只能有一个实例而且自动实例化并且向整个系统提 ...

  2. Win7_x64下卸载Oracle11g

    Windows下Oracle11g卸载顺序1.计算机管理-->服务和应用程序-->停止所有Oracle相关服务2.运行D:\app\Administrator\product\11.2.0 ...

  3. 简易浏览器App webview

    使用 public class MainActivity extends Activity {     @Override     protected void onCreate(Bundle sav ...

  4. UILable  /  UITextField  /   UIButton

    // 获取屏幕大小的view UIView *contentView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; // ...

  5. Asp.Net--主题/皮肤文件

    主题 是皮肤的集合.皮肤描述了控件应该如何显示,它可以定义样式的属性,图片,颜色等. 如果拥有多个主题,用户可以根据需要选择主题来显示站点,这只需要通过点击按钮,从一个皮肤切换到另一个皮肤. 皮肤文件 ...

  6. MySql事务及隔离级别

    在数据库中,所谓事务是指作为单个逻辑工作单元执行的一系列操作. 事务的操作: 先定义开始一个事务,然后对数据作修改操作, 这时如果提交(COMMIT),这些修改就永久地保存下来 如果回退(ROLLBA ...

  7. 你好,C++(18) 到底要不要买这个西瓜?4.1.6 操作符之间的优先顺序

    4.1.6 操作符之间的优先顺序 在表达一些比较复杂的条件判断时,在同一个表达式中,有时可能会存在多个操作符.比如,我们在判断要不要买某个西瓜时,不仅要判断它的总价(单价8.2元/斤,一共10.3斤) ...

  8. SVN搭建本地版本控制仓库

    1.安装TortoiseSVN 2.新建一个文件夹,比如F:\SvnProjectsCfg 3.在F:\SvnProjectsCfg新建一个文件夹project1,右键该文件夹选择“create re ...

  9. 12个用得着的JQuery代码片段

    1. 导航菜单背景切换效果 在项目的前端页面里,相对于其它的导航菜单,激活的导航菜单需要设置不同的背景.这种效果实现的方式有很多种,下面是使用JQuery实现的一种方式: <ul id='nav ...

  10. libevent入门(1)

    libevent是什么                libevent 库实际上没有更换 select().poll() 或其他机制的基础.而是使用对于每个平台最高效的高性能解决方案在实现外加上一个包 ...