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

var foo = Rx.Observable.interval(1000);

/*
--0--1--2--3--4--5--6--7-
filter(x => x % 2 === 0)
--0-----2-----4-----6----
*/ var bar = foo.filter(x => x % 2 === 0); bar.subscribe(
function (x) { console.log('next ' + x); },
function (err) { console.log('error ' + err); },
function () { console.log('done'); },
);

[RxJS] Filtering operator: filter的更多相关文章

  1. [RxJS] Filtering operator: single, race

    Single, race both get only one emit value from the stream. Single(fn): const source = Rx.Observable. ...

  2. [RxJS] Filtering operators: distinct and distinctUntilChanged

    Operator distinct() and its variants are an important type of Filtering operator. This lessons shows ...

  3. rxjs自定义operator

    rxjs自定义operator

  4. [RxJS] Filtering operators: take, first, skip

    There are more operators in the filtering category besides filter(). This lesson will teach how take ...

  5. [RxJS] Utility operator: do

    We just saw map which is a transformation operator. There are a couple of categories of operators, s ...

  6. [RxJS] Creation operator: of()

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

  7. [RxJS] Connection operator: multicast and connect

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

  8. [RxJS] Transformation operator: repeat

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

  9. [RxJS] Filtering operators: throttle and throttleTime

    Debounce is known to be a rate-limiting operator, but it's not the only one. This lessons introduces ...

随机推荐

  1. web系统

    现在的web系统已经越来越多的应用缓存技术,而且缓存技术确实是能实足的增强系统性能的.我在项目中也开始接触一些缓存的需求. 开始简单的就用jvm(java托管内存)来做缓存,这样对于单个应用服务器来说 ...

  2. Coursera《machine learning》--(14)数据降维

    本笔记为Coursera在线课程<Machine Learning>中的数据降维章节的笔记. 十四.降维 (Dimensionality Reduction) 14.1 动机一:数据压缩 ...

  3. data guard switchover切换异常

    data guard switchover切换异常 查看DG数据库备份库发现,switchover_status为SWITCHOVER LATENT SQL> select OPEN_MODE, ...

  4. Java中getAttribute getParameter 区别

            网上说的不少,发现都是同一篇,汗..... (1)HttpServletRequest类有setAttribute()方法,而没有setParameter()方法 (2)当两个Web组 ...

  5. DIV焦点事件

    div本来是没有focus和blur事件的. 如果用div来模拟一个input标签,同时需要它和input一样响应focus和blur事件, 就需要给他加上attribute:tabindex An ...

  6. Js 表单序列化

    http://www.w3cmm.com/javascript/serialize-form.html

  7. SlimFTPd, LFTP和FileZilla Client/Server

    https://lftp.yar.ru/ 绝好的Socket项目

  8. haproxy实现mysql slave负载均衡

    简单画一个图: 一.服务器规划 192.168.116.132 (master)  -->写操作 192.168.116.129 (slave1)  -->读操作 192.168.116. ...

  9. 【转】压缩Virtualbox的vdi文件

    原文网址:http://i.rexdf.org/blog/2014/10/06/ya-suo-virtualboxde-vdiwen-jian/ 问题实际上比较简单,我在Arch Linux杂记中给出 ...

  10. (转载)vsftpd简易配置

    (转载)http://licong.blog.51cto.com/542131/145748/ 写篇关于vsftp配置的文章,加深自己的记忆,便于自己查阅,同时也希望能给其他需要的朋友一点借鉴.本文如 ...