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. 【python之旅】python简介和入门

    python简介: 一.什么是python python的创始人为吉多·范罗苏姆(Guido van Rossum).1989年的圣诞节期间,吉多·范罗苏姆为了打发时间,决心开发一个新的脚本解释程序, ...

  2. SQL的四种语言和数据库范式

    1. SQL的四种语言 DDL(Data Definition Language)数据库定义语言 CREATE ALTER DROP TRUNCATE COMMENT RENAME DML(Data ...

  3. Start an installation from GRUB

    Start an installation from GRUB Description This tip will show you how to start an installation for ...

  4. C语言学习笔记(一):数组传递时退化为指针

    这几天闲来无事,写了一个数组元素排序函数如下: #include <stdio.h> #include <stdlib.h> void ArraySort(int array[ ...

  5. 第一个deeplearning4jproject跑起

    deeplearning4j是基于java的深度学习库,当然,它有许多特点,但暂时还没学那么深入,所以就不做介绍了 需要学习dl4j,无从下手,就想着先看看官网的examples,于是,下载了exam ...

  6. Sed&awk笔记之awk篇

    http://blog.csdn.net/a81895898/article/details/8482333 Awk是什么 Awk.sed与grep,俗称Linux下的三剑客,它们之间有很多相似点,但 ...

  7. Spring REST

    前面介绍过Spring的MVC结合不同的view显示不同的数据,如:结合json的 view显示json.结合xml的view显示xml文档.那么这些数据除了在WebBrowser中用JavaScri ...

  8. LeetCode解题报告:Reorder List

    Reorder List Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… Yo ...

  9. python装饰器之使用情景分析

    http://blog.csdn.net/yueguanghaidao/article/details/10089181

  10. bzoj1211

    prufer码水题(n-2)!/[(d1-1)!*(d2-1)!*…*(dn-1)!] ..] of longint; x,n,i,j,s:longint; ans:int64; begin read ...