If I have an array, and I want to apply filter, map, forEach to it.

let Observable = Rx.Observable;

let ary = Observable.fromArray([1,2,5,4,6]);

ary
.filter((item) => item % 2===1)
.map((item)=> item + "!")
.forEach((item) => console.log(item));
/*
"1!"
"5!"
*/

The same opreations filter, map, foreach can also handler async data which arrive over time:

let Observable = Rx.Observable;

let ary = Observable.interval(500).take(8);

ary
.filter((item) => item % 2===1)
.map((item)=> item + "!")
.forEach((item) => console.log(item)); /**
"1!"
"3!"
"5!"
"7!"
*/

[rxjs] Async, handle data over time的更多相关文章

  1. [Dart] Capture and Handle Data Sequences with Streams in Dart

    Streams represent a sequence of asynchronous events. Each event is either a data event, also called ...

  2. layui jquery ajax,url,type,async,dataType,data

    $.ajax({ url: '/foensys/user/userDelete/'+data[0].id, type:"get", async:true, dataType:&qu ...

  3. [RxJS] Displaying Initial Data with StartWith

    You often need to render out data before you stream begins from a click or another user interaction. ...

  4. 微信小程序的wx.login用async和data解决code不一致的问题

    由于wx.login是异步函数,导致在我们获取微信小程序返回的code去请求我们的登录接口时code的值会异常.现在用promise封装一下,将他success的结果返回,在登陆函数中await就可以 ...

  5. Angular快速学习笔记(4) -- Observable与RxJS

    介绍RxJS前,先介绍Observable 可观察对象(Observable) 可观察对象支持在应用中的发布者和订阅者之间传递消息. 可观察对象可以发送多个任意类型的值 -- 字面量.消息.事件. 基 ...

  6. Working with Data » Getting started with ASP.NET Core and Entity Framework Core using Visual Studio » 排序、筛选、分页以及分组

    Sorting, filtering, paging, and grouping 7 of 8 people found this helpful By Tom Dykstra The Contoso ...

  7. (译文)学习ES6非常棒的特性——Async / Await函数

    try/catch 在使用Async/Await前,我们可能这样写: const main = (paramsA, paramsB, paramsC, done) => { funcA(para ...

  8. promise async await使用

    1.Promise (名字含义:promise为承诺,表示其他手段无法改变) Promise 对象代表一个异步操作,其不受外界影响,有三种状态: Pending(进行中.未完成的) Resolved( ...

  9. 6个Async/Await完胜Promise的原因

    友情提醒:NodeJS自从7.6版开始已经内置了对async/await的支持.如果你还没用过该特性,那么接下来我会给出一系列的原因解释为何你应该立即开始使用它并且会结合示例代码说明. async/a ...

随机推荐

  1. OC中格式化输出符号

    定义 说明 %@ Objective-C object, printed as the string returned by descriptionWithLocale: if available, ...

  2. 第 6 章 抽象工厂模式【Abstract Factory Pattern】

    以下内容出自:<<24种设计模式介绍与6大设计原则>> 好了,我们继续上一节课,上一节讲到女娲造人,人是造出来了,世界时热闹了,可是低头一看,都 是清一色的类型,缺少关爱.仇恨 ...

  3. SQL Server 2005 版本的操作系统兼容性详细列表

    操作系统要求(32 位) 此表显示对于每种 32 位版本的 SQL Server 2005,操作系统是否可以运行其服务器软件. 有关如何在 Windows Server 2008 上安装 SQL Se ...

  4. ubuntu service

    http://blog.chinaunix.net/uid-21528208-id-2399656.html

  5. 高远介绍的好东东--django-celery

    终于可以到异步消息机制的高档产品啦~~~ 不知能不能代替AJAX.. 参照官方文档试下: 中文文档: http://docs.jinkan.org/docs/celery/getting-starte ...

  6. Buying Feed, 2010 Nov (单调队列优化DP)

    约翰开车回家,又准备顺路买点饲料了(咦?为啥要说"又"字?)回家的路程一共有 E 公里,这一路上会经过 K 家商店,第 i 家店里有 Fi 吨饲料,售价为每吨 Ci 元.约翰打算买 ...

  7. Windows编程中的堆管理(过于底层,一般不用关心)

    摘要: 本文主要对Windows内存管理中的堆管理技术进行讨论,并简要介绍了堆的创建.内存块的分配与再分配.堆的撤销以及new和delete操作符的使用等内容. 关键词: 堆:堆管理 1 引言 在大多 ...

  8. [译]GotW #1: Variable Initialization

    原文地址:http://herbsutter.com/2013/05/09/gotw-1-solution/ 第一个问题强调的是要明白自己在写什么的重要性.下面有几行简单的代码--它们大多数之间都有区 ...

  9. IPVS实现分析

    IPVS实现分析 IPVS实现分析 根据LVS官方网站的介绍,LVS支持三种负载均衡模式:NAT,tunnel和direct routing(DR). NAT是通用模式,所有交互数据必须通过均衡器:后 ...

  10. wcf中netTcpBinding的元素构成

    <security> of <netTcpBinding> <transport> of <netTcpBinding> <message> ...