[RxJS] Filtering operator: filter
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的更多相关文章
- [RxJS] Filtering operator: single, race
Single, race both get only one emit value from the stream. Single(fn): const source = Rx.Observable. ...
- [RxJS] Filtering operators: distinct and distinctUntilChanged
Operator distinct() and its variants are an important type of Filtering operator. This lessons shows ...
- rxjs自定义operator
rxjs自定义operator
- [RxJS] Filtering operators: take, first, skip
There are more operators in the filtering category besides filter(). This lesson will teach how take ...
- [RxJS] Utility operator: do
We just saw map which is a transformation operator. There are a couple of categories of operators, s ...
- [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] Filtering operators: throttle and throttleTime
Debounce is known to be a rate-limiting operator, but it's not the only one. This lessons introduces ...
随机推荐
- 从一个标准 url 里取出文件的扩展名
在php预定义函数中有一个叫做"pathinfo()"的函数,专门用于返回文件路径信息的. 那好,我们就来看一下它能为我们做些什么? 语法:pathinfo($url_ ...
- Delphi 停靠技术的应用
一.基础知识介绍 1.VCL组件的基础知识 在TWinControl类中有一个DockSite属性(boolean),它的作用是是否允许别的控件停靠在它的上面:在TControl类中有一个DragKi ...
- 正确安装 django-socketio
直接使用 pip 安装,连 example project 都运行不了... 要正常使用,关键是要使用正确版本的依赖包 Django (1.5.5) django-socketio (0.3.2) g ...
- u-boot Makefile Source Test
一.概述 笔者已经写了一篇实现目标文件与源码分开的makefile测试实验,但是觉得不够完美,没有更多的体现u-boot Makefile的工作原理和特点.所以,决定重新修订,使之更加充分的接近u-b ...
- 目前最流行的网页自动运行EXE文件
大家对木马都不陌生了,它可能要算是计算机病毒史上最厉害的了,相信会使木马的人千千万万,但是有很多人苦于怎么把木马发给对方,现在随着计算机的普及,在网络上我相信很少有人会再轻易的接收对方的文件了,所以网 ...
- java环境变量设置方法
1.安装JDK,安装过程中可以自定义安装目录等信息,例如我们选择安装目录为D:\java\jdk1.5.0_08: 2.安装完成后,右击“我的电脑”,点击“属性”: 3.选择“高 ...
- HashMap遍历,推荐使用entrySet()
之前map遍历,偶尔会先去keyset然后再遍历keyset 比如 Map map = new HashMap(); Iterator it = map.keySet().iterator(); wh ...
- Matlab绘图系列之高级绘图
Matlab绘图系列之高级绘图 原帖地址: http://blog.163.com/enjoy_world/blog/static/115033832007865616218/ Matlab绘图 20 ...
- 【POJ11855】 Buzzwords (后缀数组)
Description The word “the” is the most commonthree-letter word. It evenshows up inside other words, ...
- FLASH 存储学习-串行SPI NOR FLASH
1.1 SST25VF080B简介1.1.1 主要特性 关键点:容量.速度(时钟速度.读写速度).功耗. l 容量:8MBit: l 最高SPI时钟频率:50MHz: l 低功耗模式下电流消耗:5uA ...