[RxJS] Use RxJS mergeMap to map and merge high order observables
Like RxJS switchMap() is a shortcut for map() and switch(), we will see in this lesson how mergeMap() is a shortcut for map() and mergeAll(), and learn its arguments for customised behavior.
const clickObservable = Rx.Observable
.fromEvent(document, 'click'); function performRequest() {
return fetch('https://jsonplaceholder.typicode.com/users/1')
.then(res => res.json());
} const emailObservable = clickObservable
.mergeMap(click => performRequest(),
(click, res) => res.email, // selector function
); // number of concurrency // mergeMap = map ... + ... mergeAll emailObservable
.subscribe(email => console.log(email));
[RxJS] Use RxJS mergeMap to map and merge high order observables的更多相关文章
- [RxJS] Use RxJS concatMap to map and concat high order observables
Like switchMap and mergeMap, concatMap is a shortcut for map() followed by a concatAll(). In this le ...
- [RxJS] Getting Input Text with Map
By default, Inputs will push input events into the stream. This lesson shows you how to use map to c ...
- [RxJS] Implement RxJS `mergeMap` through inner Observables to Subscribe and Pass Values Through
Understanding sources and subscribers makes it much easier to understand what's going on with mergeM ...
- [RxJS] Implement RxJS `switchMap` by Canceling Inner Subscriptions as Values are Passed Through
switchMap is mergeMap that checks for an "inner" subscription. If the "inner" su ...
- [RxJS] Chain RxJS Operators Together with a Custom `pipe` Function using Array.reduce
Instead of writing complex operators, it's usually best to write simple, single-purpose operators th ...
- [RxJS] Convert RxJS Subjects to Observables
The use of RxJS Subjects is common, but not without problems. In this lesson we will see how they ca ...
- [RxJS] Implement RxJS `concatMap` by Waiting for Inner Subscriptions to Complete
Unlike mergeMap and switchMap, concatMap focuses on when "inner" subscriptions "compl ...
- [RxJS] What RxJS operators are
We have covered the basics of what is Observable.create, and other creation functions. Now lets fina ...
- RxJS速成 (下)
上一部分: http://www.cnblogs.com/cgzl/p/8641738.html Subject Subject比较特殊, 它即是Observable又是Observer. 作为Obs ...
随机推荐
- 利用日志使管理Linux更轻松
利用日志使管理Linux更轻松 操作系统的日志主要具有审计与监测的功能,通过对日志信息的分析,可以检查错误发生的原因,监测追踪入侵者及受到攻击时留下的痕迹,甚至还能实时的进行系统状态的监控.有效利用日 ...
- BZOJ2434: [Noi2011]阿狸的打字机(fail树+dfs序)
Description 阿狸喜欢收藏各种稀奇古怪的东西,最近他淘到一台老式的打字机.打字机上只有28个按键,分别印有26个小写英文字母和'B'.'P'两个字母. 经阿狸研究发现,这个打字机是这样工作的 ...
- ThinkPHP5.0---静态方法
ThinkPHP5大量的使用了这种可以直接使用::调用的方法,它们有一个很响亮的名字:静态方法.静态方法的引用,大幅提升了程序的运行效率,降低了资源的占用. 静态方法(ASK$ANSWER) 为什么要 ...
- 【Codeforces Round #428 (Div. 2) C】Journey
[Link]:http://codeforces.com/contest/839/problem/C [Description] 给一棵树,每当你到一个点x的时候,你进入x的另外一每一个出度的概率都是 ...
- 字串乱序 PHP&JS
<?php /** * 字串乱序 PHP&JS * * php 中把字串乱序后输出给客户机的 JAVASCRIPT , JAVASCRIPT 中恢复 * 在指定长度提取一个字符,并把这一 ...
- React-怎么写好组件-简单
数据层:用来决定按钮的个数以及按钮是否选择. 表现层(展示层):按钮使用现有的ui 组件. 逻辑层(业务层):按钮事件等逻辑处理.
- PythonNET网络编程3
IO IO input output 在内存中存在数据交换的操作都可以认为是IO操作 和终端交互 : input print 和磁盘交互 : read write 和网络交互 : recv send ...
- noi25 最长最短单词(为什么会出现运行时错误)
noi25 最长最短单词(为什么会出现运行时错误) 一.总结 一句话总结:比如除以零,数组越界,指针越界,使用已经释放的空间,数组开得太大,超出了栈的范围,造成栈溢出 1.c++报runtime er ...
- amazeui学习笔记--css(常用组件13)--进度条Progress
amazeui学习笔记--css(常用组件13)--进度条Progress 一.总结 1.进度条基本使用:进度条组件,.am-progress 为容器,.am-progress-bar 为进度显示信息 ...
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
meta name="viewport" content="width=device-width,initial-scale=1.0" 解释 <meta ...